[BusyBox] bug#1222: [PATCH]: md5sum broken

David Kimdon dwhedon at instant802.com
Fri Nov 16 17:00:03 UTC 2001


Package: busybox
Version: 0.60.1


Hi,

Bug in md5sum.  It can't verify sums that aren't generated in binary
mode, that is, sums that don't have a '*' in front of the filename.
The bug exists in current cvs as well as 0.60.1.

I call this bad:
$ ./md5sum md5sum > md5sum.md5
$ ./md5sum -c md5sum.md5
md5sum:  md5sum: No such file or directory
 md5sum: FAILED open or read
md5sum: WARNING: 1 of 1 listed files could not be read
$

If I do it in binary mode it works:
$ ./md5sum -b md5sum > md5sum.md5
$ ./md5sum -c md5sum.md5 
md5sum: OK
$ 

After applying the included patch we get good behavior:
$ ./md5sum md5sum > md5sum.md5 
$ ./md5sum -c md5sum.md5 
md5sum: OK
$ ./md5sum -b md5sum > md5sum.md5 
$ ./md5sum -c md5sum.md5 
md5sum: OK
$


-David

Index: textutils/md5sum.c
===================================================================
RCS file: /var/cvs/busybox/textutils/md5sum.c,v
retrieving revision 1.25
diff -u -r1.25 md5sum.c
--- textutils/md5sum.c	2001/07/12 20:26:31	1.25
+++ textutils/md5sum.c	2001/11/16 23:37:07
@@ -699,12 +699,12 @@
 
   s[i++] = '\0';
 
-  if (s[i] != ' ' && s[i++] != '*')
+  if (s[i] != ' ' && s[i] != '*')
     return FALSE;
 
   /* All characters between the type indicator and end of line are
      significant -- that includes leading and trailing white space.  */
-  *w = &s[i];
+  *w = &s[++i];
 
   if (escaped_filename) {
     /* Translate each `\n' string in the file name to a NEWLINE,








More information about the busybox mailing list