[PATCH] modutils/modprobe.c: Avoid a possible NULL pointer dereference +4
Tito
farmatito at tiscali.it
Tue Jan 26 12:57:05 UTC 2010
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 at 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
More information about the busybox
mailing list