busybox/coreutils
Eric Andersen 52499cb9ae Tito writes:
Hi,
I've spent the half night staring at the devilish  my_getpwuid and my_getgrgid functions
trying to find out a way to avoid actual and future potential buffer overflow problems
without breaking existing code.
Finally I've  found a not intrusive way to do this that surely doesn't break existing code
and fixes a couple of problems too.
The attached patch:
1) changes the behaviour of my_getpwuid and my_getgrgid to avoid potetntial buffer overflows
2) fixes all occurences of this function calls in tar.c , id.c , ls.c, whoami.c, logger.c, libbb.h.
3) The behaviour of tar, ls and  logger is unchanged.
4) The behavior of ps with somewhat longer usernames messing up output is fixed.
5) The only bigger change was the increasing of size of the buffers in id.c to avoid
     false negatives (unknown user: xxxxxx) with usernames longer than 8 chars.
     The value i used ( 32 chars ) was taken from the tar header ( see gname and uname).
     Maybe this buffers can be reduced a bit  ( to 16 or whatever ), this is up to you.
6) The increase of size of the binary is not so dramatic:
     size busybox
       text    data     bss     dec     hex filename
     239568    2300   36816  278684   4409c busybox
    size busybox_fixed
       text    data     bss     dec     hex filename
     239616    2300   36816  278732   440cc busybox
7) The behaviour of whoami changed:
    actually it  prints out an username cut down to the size of the buffer.
    This could be fixed by increasing the size of the buffer as in id.c or
    avoid the use of my_getpwuid and use getpwuid directly instead.
    Maybe this colud be also remain unchanged......

Please apply if you think it is ok to do so.
The diff applies on today's cvs tarball (2004-08-25).
Thanks in advance,
Ciao,
Tito
2004-08-26 22:18:59 +00:00
..
libcoreutils Remove trailing whitespace. Update copyright to include 2004. 2004-03-15 08:29:22 +00:00
basename.c Remove trailing whitespace. Update copyright to include 2004. 2004-03-15 08:29:22 +00:00
cal.c Larry Doolittle writes: 2004-04-14 17:51:38 +00:00
cat.c As we no longer use function pointers for read in common archiving code 2003-11-21 22:24:57 +00:00
chgrp.c Remove trailing whitespace. Update copyright to include 2004. 2004-03-15 08:29:22 +00:00
chmod.c Remove trailing whitespace. Update copyright to include 2004. 2004-03-15 08:29:22 +00:00
chown.c Remove trailing whitespace. Update copyright to include 2004. 2004-03-15 08:29:22 +00:00
chroot.c Remove trailing whitespace. Update copyright to include 2004. 2004-03-15 08:29:22 +00:00
cmp.c Larry Doolittle writes: 2004-04-14 17:51:38 +00:00
Config.in Patch from Bastian Blank to add 64 bit support to the test command. 2004-08-11 02:45:47 +00:00
cp.c Add the -r option as a synonym of -R 2004-01-25 05:50:28 +00:00
cut.c Larry Doolittle writes: 2004-04-14 17:51:38 +00:00
date.c Larry Doolittle writes: 2004-04-14 17:51:38 +00:00
dd.c Avoid symbol naming conflict with libm 2004-01-30 22:24:32 +00:00
df.c Tito, farmatito at tiscali dot it writes: 2004-08-03 00:14:02 +00:00
dirname.c Remove trailing whitespace. Update copyright to include 2004. 2004-03-15 08:29:22 +00:00
dos2unix.c Steve Grubb writes: 2004-05-05 19:39:21 +00:00
du.c Remove trailing whitespace. Update copyright to include 2004. 2004-03-15 08:29:22 +00:00
echo.c Larry Doolittle writes: 2004-04-14 17:51:38 +00:00
env.c Thats odd. I guess this was cut-n-paste error, but vodz 2004-04-16 15:02:10 +00:00
expr.c Larry Doolittle writes: 2004-04-14 17:51:38 +00:00
false.c Remove trailing whitespace. Update copyright to include 2004. 2004-03-15 08:29:22 +00:00
fold.c Update my email address, document some of my tasks in the AUTHORS file 2004-04-25 05:11:19 +00:00
head.c Major coreutils update. 2003-03-19 09:13:01 +00:00
hostid.c Major coreutils update. 2003-03-19 09:13:01 +00:00
id.c Tito writes: 2004-08-26 22:18:59 +00:00
install.c Update my email address, document some of my tasks in the AUTHORS file 2004-04-25 05:11:19 +00:00
length.c Major coreutils update. 2003-03-19 09:13:01 +00:00
ln.c Remove trailing whitespace. Update copyright to include 2004. 2004-03-15 08:29:22 +00:00
logname.c Larry Doolittle writes: 2004-04-14 17:51:38 +00:00
ls.c Tito writes: 2004-08-26 22:18:59 +00:00
Makefile Remove trailing whitespace. Update copyright to include 2004. 2004-03-15 08:29:22 +00:00
Makefile.in Remove trailing whitespace. Update copyright to include 2004. 2004-03-15 08:29:22 +00:00
md5_sha1_sum.c Larry Doolittle writes: 2004-04-14 17:51:38 +00:00
mkdir.c last_patch89 from vodz: 2003-06-20 09:01:58 +00:00
mkfifo.c Major coreutils update. 2003-03-19 09:13:01 +00:00
mknod.c Remove trailing whitespace. Update copyright to include 2004. 2004-03-15 08:29:22 +00:00
mv.c Remove trailing whitespace. Update copyright to include 2004. 2004-03-15 08:29:22 +00:00
od.c Felipe Kellermann writes, 2004-07-23 01:42:28 +00:00
printf.c Remove trailing whitespace. Update copyright to include 2004. 2004-03-15 08:29:22 +00:00
pwd.c Major coreutils update. 2003-03-19 09:13:01 +00:00
realpath.c Major coreutils update. 2003-03-19 09:13:01 +00:00
rm.c last_patch89 from vodz: 2003-06-20 09:01:58 +00:00
rmdir.c Remove trailing whitespace. Update copyright to include 2004. 2004-03-15 08:29:22 +00:00
seq.c Patch from Felipe Kellermann, fix endless loop when first > last and 2004-07-23 06:43:29 +00:00
sleep.c Major coreutils update. 2003-03-19 09:13:01 +00:00
sort.c Major coreutils update. 2003-03-19 09:13:01 +00:00
stty.c last_patch89 from vodz: 2003-06-20 09:01:58 +00:00
sync.c Major coreutils update. 2003-03-19 09:13:01 +00:00
tail.c Remove trailing whitespace. Update copyright to include 2004. 2004-03-15 08:29:22 +00:00
tee.c If read were to return with an error, bad things would happen. Fix it. 2004-05-26 15:21:19 +00:00
test.c Patch from Bastian Blank to add 64 bit support to the test command. 2004-08-11 02:45:47 +00:00
touch.c Remove trailing whitespace. Update copyright to include 2004. 2004-03-15 08:29:22 +00:00
tr.c Remove trailing whitespace. Update copyright to include 2004. 2004-03-15 08:29:22 +00:00
true.c Remove trailing whitespace. Update copyright to include 2004. 2004-03-15 08:29:22 +00:00
tty.c Major coreutils update. 2003-03-19 09:13:01 +00:00
uname.c Major coreutils update. 2003-03-19 09:13:01 +00:00
uniq.c Major coreutils update. 2003-03-19 09:13:01 +00:00
usleep.c Major coreutils update. 2003-03-19 09:13:01 +00:00
uudecode.c Update my email address, document some of my tasks in the AUTHORS file 2004-04-25 05:11:19 +00:00
uuencode.c Pascal Brisset writes: 2004-01-26 07:17:30 +00:00
watch.c Major coreutils update. 2003-03-19 09:13:01 +00:00
wc.c Remove trailing whitespace. Update copyright to include 2004. 2004-03-15 08:29:22 +00:00
who.c Remove trailing whitespace. Update copyright to include 2004. 2004-03-15 08:29:22 +00:00
whoami.c Tito writes: 2004-08-26 22:18:59 +00:00
yes.c Major coreutils update. 2003-03-19 09:13:01 +00:00