[BusyBox] 14 bugs on the wall
Larry Doolittle
ldoolitt at recycle.lbl.gov
Tue Apr 17 19:03:33 UTC 2001
<music>
14 silly bugs on the wall,
14 silly bugs ....
take one down, pass it around,
13 silly bugs on the wall!
</music>
$ grep "strlen([^)]*) *- *1" *.c libbb/*.c
You can argue that some of these bugs are not real,
cut.c for instance probably can not make it to that
section of the code with strlen()==0.
Even when I fixed the error in dirname.c (patch below),
the code still matches the regexp above. Maybe we need
a source code comment flag like we have for getopt, to
tell everyone that an instance of this regexp has been
checked for safety from array underrun.
- Larry
--- cvs/busybox/dirname.c Fri Mar 9 17:00:12 2001
+++ dirname.c Tue Apr 17 12:00:24 2001
@@ -37,7 +37,7 @@
argv++;
s=*argv+strlen(*argv)-1;
- while (s != *argv && *s == '/') {
+ while (s > *argv && *s == '/') {
*s-- = '\0';
}
s = strrchr(*argv, '/');
More information about the busybox
mailing list