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

Re: [libvirt] [PATCH] Avoid a libvirtd crash on broken input 523418



On Wed, Sep 30, 2009 at 05:48:49PM +0100, Mark McLoughlin wrote:
> On Wed, 2009-09-30 at 18:33 +0200, Daniel Veillard wrote:
> > diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
> > index 868e865..9cf0af1 100644
> > --- a/src/conf/domain_conf.c
> > +++ b/src/conf/domain_conf.c
> > @@ -1032,7 +1032,8 @@ virDomainNetDefParseXML(virConnectPtr conn,
> >              } else if ((ifname == NULL) &&
> >                         xmlStrEqual(cur->name, BAD_CAST "target")) {
> >                  ifname = virXMLPropString(cur, "dev");
> > -                if (STRPREFIX((const char*)ifname, "vnet")) {
> > +                if ((ifname != NULL) &&
> > +                    (STRPREFIX((const char*)ifname, "vnet"))) {
> >                      /* An auto-generated target name, blank it out */
> >                      VIR_FREE(ifname);
> >                  }
> 
> Modulo the redundant parenthesis, looks good to me :-)

  I like my expressions fully parenthesized, like one use if (a) then
if ((a) && (b)) is the logical next step. Plus STRPREFIX being a macro
I really prefer to keep it bounded :-)

  that said, it's commited ! thanks

Daniel

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


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