[libvirt] [PATCH] remote_internal.c: don't dereference a NULL "conn"

Daniel Veillard veillard at redhat.com
Wed Sep 2 10:23:41 UTC 2009


On Wed, Sep 02, 2009 at 11:58:07AM +0200, Jim Meyering wrote:
> Here's the test just before the else-if in the patch below:
> 
>     if (conn &&
>         conn->driver &&
>         STREQ (conn->driver->name, "remote")) {
> 
> So, in the else-branch, "conn" is guaranteed to be NULL.
> And dereferenced.
> 
> This may be only a theoretical risk, but if so,
> the test of "conn" above should be changed to an assertion,
> and/or the parameter should get the nonnull attribute.

  I'm fine with your patch, so that even if code around changes
having a gard is IMHO a good thing

  ACK

   thanks !

Daniel

-- 
Daniel Veillard      | libxml Gnome XML XSLT toolkit  http://xmlsoft.org/
daniel at veillard.com  | Rpmfind RPM search engine http://rpmfind.net/
http://veillard.com/ | virtualization library  http://libvirt.org/




More information about the libvir-list mailing list