286df29e7d
This has already been suggested by Evan Gates <evan.gates@gmail.com> and he's totally right about it. So, what's the problem? I wrote a testing program asshole.c with int main(void) { execl("/path/to/sbase/echo", "echo", "test"); return 0; } and checked the results with glibc and musl. Note that the sentinel NULL is missing from the end of the argument list. glibc calculates an argc of 5, musl 4 (instead of 2) and thus mess up things anyway. The powerful arg.h also focuses on argv instead of argc as well, but ignoring argc completely is also the wrong way to go. Instead, a more idiomatic approach is to check *argv only and decrement argc on the go. While at it, I rewrote yes(1) in an argv-centric way as well. All audited tools have been "fixed" and each following audited tool will receive the same treatment. |
||
---|---|---|
.. | ||
agetcwd.c | ||
apathmax.c | ||
concat.c | ||
cp.c | ||
crypt.c | ||
ealloc.c | ||
enmasse.c | ||
eprintf.c | ||
eregcomp.c | ||
estrtod.c | ||
fnck.c | ||
getlines.c | ||
human.c | ||
md5.c | ||
mode.c | ||
putword.c | ||
recurse.c | ||
rm.c | ||
sha1.c | ||
sha256.c | ||
sha512.c | ||
strcasestr.c | ||
strlcat.c | ||
strlcpy.c | ||
strsep.c | ||
strtonum.c | ||
unescape.c |