[prev in list] [next in list] [prev in thread] [next in thread]
List: busybox
Subject: Re: [PATCH] modutils/modprobe.c: Avoid a possible NULL pointer
From: Tito <farmatito () tiscali ! it>
Date: 2010-01-26 12:57:05
Message-ID: 201001261357.05205.farmatito () tiscali ! it
[Download RAW message or body]
On Tuesday 26 January 2010 09:05:34 Ozan Çağlayan wrote:
> Denys Vlasenko wrote On 26-01-2010 09:17:
> > On Tuesday 26 January 2010 08:09, Ozan Çağlayan wrote:
>
> > How about protecting other branch too?
> >
> > if (append) {
> > if (opts == NULL) {
> > opts = xstrdup(append);
> > } else {
> > int optlen = strlen(opts);
> > opts = xrealloc(opts, optlen + strlen(append) + 2);
> > sprintf(opts + optlen, " %s", append);
> > }
> > }
>
> Hm yes that seems clearer even xstrdup handles NULL pointers too. Will send the revised patch, thanks.
> _______________________________________________
> busybox mailing list
> busybox@busybox.net
> http://lists.busybox.net/mailman/listinfo/busybox
Maybe some libbb xstrlen() ??
int xstrlen(char *str)
{
if (!str)
return 0;
// or maybe -1
return strlen(str);
}
Ciao,
Tito
_______________________________________________
busybox mailing list
busybox@busybox.net
http://lists.busybox.net/mailman/listinfo/busybox
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic