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

Mark McLoughlin markmc at redhat.com
Wed Sep 30 16:48:49 UTC 2009


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 :-)

ACK

Cheers,
Mark.




More information about the libvir-list mailing list