[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Bug report on freebsd-buildutils: mtree crashes with exit status 139



2013/6/27 Steven Chamberlain <steven@pyro.eu.org>:
> --- freebsd-buildutils-9.0.orig/src/usr.sbin/mtree/spec.c       2013-06-27 19:11:08.000000000 +0000
> +++ freebsd-buildutils-9.0/src/usr.sbin/mtree/spec.c    2013-06-27 20:34:30.390244550 +0000
> @@ -89,8 +89,12 @@
>                 for (p = buf; *p && isspace(*p); ++p);
>
>                 /* If nothing but whitespace or comment char, continue. */
> -               if (!*p || *p == '#')
> +               if (!*p || *p == '#') {
> +                       /* Ignore continuation character, if any */
> +                       if (*p == '#')
> +                               c_next = 0;
>                         continue;
> +               }
>
>  #ifdef DEBUG
>                 (void)fprintf(stderr, "line %d: {%s}\n", lineno, p);

This looks like null dereference coming when !*p. May I suggest instead:

if (!*p)
  continue;

if (*p == '#')
  {
     ...
  }

Btw, can we avoid adding more to the ever-growing patchset? I'm sure
upstream would like to have this kind of fixes. I can even check it in
myself if someone is kind enough to check that it passes a full
"buildworld/installworld".


Reply to: