Skip to content

Commit d154c21

Browse files
committed
Fix an error in how cksum parses checksum files
When cksum (or sha256sum, etc...) attempts to parse chekcusm files in the "tagged output format" and it encounters the string "((", it crashes due to an error in how it parses the checksum file. GNU coreutils, by contrast, correctly recognizes this string as a syntax error and ignores the line.
1 parent d868818 commit d154c21

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

src/uucore/src/lib/features/checksum/validate.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -281,6 +281,9 @@ impl LineFormat {
281281
// tagged format does not put a space before (filename)
282282

283283
let par_idx = rest.iter().position(|&b| b == b'(')?;
284+
if par_idx < 1 {
285+
return None;
286+
}
284287
let sub_case = if rest[par_idx - 1] == b' ' {
285288
SubCase::Posix
286289
} else {

0 commit comments

Comments
 (0)