Hi Denys, thanks a lot for the quick patch. 
  I reran our tool on top, and it did find an error in the patch.  The
problem is that you are using alloca() in getopt32():

495: if (pargv[0][0] != '-' && pargv[0][0] != '\0') {
496:     char *pp = alloca(strlen(*pargv) + 2);
  
which is later dereferenced here on top.c:768, after getopt32() returns:

766: if (getopt32(argv, "d:n:b", &sinterval, &iterations) & OPT_d) {
767:     /* Need to limit it to not overflow poll timeout */
768:     interval = xatou16(sinterval); // -d
     
  After changing alloca to malloc, I didn't find any other problems in
top.

Cristian


On Wed, 2008-08-20 at 02:14 +0200, Denys Vlasenko wrote: 
> On Tuesday 19 August 2008 22:24, Cristian Cadar wrote:
> > http://bugs.busybox.net/view.php?id=4654
> > 
> > $ ./top d
> > top: invalid number '$-3õ½-$-3õ½-$-3õ½Eõ½õ½Uõ½õ½Eõ½$-3õ½U
> > 
> > top should require an argument when the "d" option is used, as in the
> > procps top:
> > 
> > $ top d
> >        top: -d requires argument
> 
> Please try this patch.
> --
> vda

_______________________________________________
busybox mailing list
[email protected]
http://busybox.net/cgi-bin/mailman/listinfo/busybox

Reply via email to