Re: [PATCH] Fix libvirtd crash when removing metadata

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

 



On 09/18/14 14:25, Erik Skultety wrote:
> When trying to remove nonexistent metadata from XML, libvirt daemon
> crashes due to dereferencing NULL pointer.
> 
> Resolves https://bugzilla.redhat.com/show_bug.cgi?id=1143955
> ---
>  src/util/virxml.c | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/src/util/virxml.c b/src/util/virxml.c
> index a91da05..f386956 100644
> --- a/src/util/virxml.c
> +++ b/src/util/virxml.c
> @@ -972,7 +972,9 @@ xmlNodePtr
>  virXMLFindChildNodeByNs(xmlNodePtr root,
>                          const char *uri)
>  {
> -    xmlNodePtr next;
> +    xmlNodePtr next = NULL;
> +    if (!root)
> +        goto cleanup;

You can return NULL right away

>  
>      for (next = root->children; next; next = next->next) {
>          if (next->ns &&
> @@ -980,6 +982,7 @@ virXMLFindChildNodeByNs(xmlNodePtr root,
>              return next;
>      }
>  
> + cleanup:

and don't bother with adding a label.

>      return NULL;
>  }
>  
> 

I'll push this shortly without the unnecessary label.

Peter


Attachment: signature.asc
Description: OpenPGP digital signature

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list

[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]