[systemd-devel] [PATCH 5/6] coredumpctl: null check before dereferencing

Michal Sekletar msekleta at redhat.com
Thu Oct 25 08:19:54 PDT 2012


On Thu, 2012-10-25 at 17:12 +0200, Michal Schmidt wrote:
> On 10/25/2012 04:16 PM, Michal Sekletar wrote:
> > ---
> >   src/journal/coredumpctl.c | 1 +
> >   1 file changed, 1 insertion(+)
> >
> > diff --git a/src/journal/coredumpctl.c b/src/journal/coredumpctl.c
> > index d15a31e..1a4d78f 100644
> > --- a/src/journal/coredumpctl.c
> > +++ b/src/journal/coredumpctl.c
> > @@ -222,6 +222,7 @@ static int retrieve(sd_journal *j, const char *name, const char **var) {
> >
> >           field = strlen(name) + 1; // name + "="
> >           assert(len >= field);
> > +        assert(var);
> >
> >           *var = strndup((const char*)data + field, len - field);
> >           if (!var)
> 
> It looks like this check really wants to be "if (!*var)"
> 
> Michal
> 
Yes, indeed it should be. Please fix both.




More information about the systemd-devel mailing list