[BusyBox] [PATCH] compiler warning removal in strings.c

Stewart Brodie stewart.brodie at pace.co.uk
Wed Mar 5 04:17:03 UTC 2003


In message <200303031433.17645.farmatito at tiscali.it>
          Tito <farmatito at tiscali.it> wrote:

> On Monday 03 March 2003 11:45, Stewart Brodie wrote [about strings.c]

> Please if you could take a look at line 86 , it seems to me that it should
> be xmalloc(n+1) .
> 
> 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

I cannot do so - I'm just submitting patches for the things that have been
causing compiler warnings to pop up.

I concur that the line xmalloc call is wrong and must be for n+1 given that
the following statement is:

  string[n] = '\0';




-- 
Stewart Brodie, Senior Software Engineer
Pace Micro Technology PLC
645 Newmarket Road
Cambridge, CB5 8PB, United Kingdom         WWW: http://www.pacemicro.com/



More information about the busybox mailing list