summaryrefslogtreecommitdiff
path: root/tests/misc/md5sum
diff options
context:
space:
mode:
authorJim Meyering <meyering@redhat.com>2008-04-18 23:42:40 +0200
committerJim Meyering <meyering@redhat.com>2008-04-19 00:24:55 +0200
commita85752ff4b7c18e6c4cf0c0e43da24080e2d0709 (patch)
treea0d49f6f75edb6a0badccb6314ab0cc607e41efa /tests/misc/md5sum
parent0d03baa068c20f09bcba3a915fd756db7359a7fa (diff)
downloadcoreutils-a85752ff4b7c18e6c4cf0c0e43da24080e2d0709.tar.xz
md5sum -c: ignore a line with a NUL byte among checksum hex digits
* src/md5sum.c (hex_digits): Require that all "digest_hex_bytes" be hexadecimal digits, not just those before the first NUL byte. This bug dates back to the original version: 3763a4f24eb21be40674d13ff7b04e078f473e85 * tests/misc/md5sum (nul-in-cksum): Test for the above. * NEWS [Bug fixes]: Mention this. Prompted by a report from Flóki Pálsson in http://bugzilla.redhat.com/439531
Diffstat (limited to 'tests/misc/md5sum')
-rwxr-xr-xtests/misc/md5sum8
1 files changed, 8 insertions, 0 deletions
diff --git a/tests/misc/md5sum b/tests/misc/md5sum
index 25069fd15..474656f24 100755
--- a/tests/misc/md5sum
+++ b/tests/misc/md5sum
@@ -66,6 +66,14 @@ my @Tests =
{AUX=> {f=> 'bar'}}, {EXIT=> 1}],
['bsd-segv', '--check', {IN=> {'z' => "MD5 ("}}, {EXIT=> 1},
{ERR=> "$prog: z: no properly formatted MD5 checksum lines found\n"}],
+
+ # Ensure that when there's a NUL byte among the checksum hex digits
+ # we detect the invalid formatting and don't even open the file.
+ # Up to coreutils-6.10, this would report:
+ # h: FAILED
+ # md5sum: WARNING: 1 of 1 computed checksum did NOT match
+ ['nul-in-cksum', '--check', {IN=> {'h'=>("\0"x32)." h\n"}}, {EXIT=> 1},
+ {ERR=> "$prog: h: no properly formatted MD5 checksum lines found\n"}],
);
# Insert the `--text' argument for each test.