[prev in list] [next in list] [prev in thread] [next in thread]
List: busybox
Subject: [BusyBox] Bugfix for strings.c in busybox unstable
From: Tito <farmatito () tiscali ! it>
Date: 2003-02-19 7:38:03
[Download RAW message or body]
Hi Erik,
I discovered a little malloc bug in strings.c for bbunstable.
If you do:
MALLOC_CHECK_=1
export MALLOC_CHECK_
./busybox strings -afo miscutils/strings.o
you get:
[snip]
miscutils/strings.o: 3056 exit
free(): invalid pointer 0x8062550!
malloc: using debugging hooks
I think I forgot to count from zero here, so fix is simple ,see the diff.
The other fixes are esthetical and to turn two compiler warnings off:
/rep/busybox/miscutils/strings.c: In function `strings_main':
/rep/busybox/miscutils/strings.c:43: warning: `t' might be used uninitialized
in this function
/rep/busybox/miscutils/strings.c:45: warning: `string' might be used
uninitialized in this function
43c43
< long t, count;
---
> long t=0, count;
45c45
< char *string;
---
> char *string=NULL;
53c53
< opt++;
---
> opt+=1;
61,62c61
< opt++;
< opt++;
---
> opt+=2;
86c85
< string=xmalloc(n);
---
> string=xmalloc(n+1);
Please apply
Thanks
CIAO TITO
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic