[libvirt] [PATCH] xend_internal.c: don't dereference NULL for unexpected input

Daniel Veillard veillard at redhat.com
Fri Feb 19 17:17:34 UTC 2010


On Fri, Feb 19, 2010 at 05:47:08PM +0100, Jim Meyering wrote:
> My recent xend_internal.c change introduced a bug.
> "val" could be NULL just before the STREQ comparisons.
> Here's a fix:
> 
> >From 5cc834ab30a444cc35ddc9317379f4be3b5cf4c5 Mon Sep 17 00:00:00 2001
> From: Jim Meyering <meyering at redhat.com>
> Date: Fri, 19 Feb 2010 17:45:41 +0100
> Subject: [PATCH] xend_internal.c: don't dereference NULL for unexpected input
> 
> * src/xen/xend_internal.c (xenDaemonDomainSetAutostart): Avoid a NULL
> dereference upon non-SEXPR_VALUE'd on_xend_start.  This bug was
> introduced by commit 37ce5600c0bb1aed9e2f2888922388de4340ebd3.
> ---
>  src/xen/xend_internal.c |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
> 
> diff --git a/src/xen/xend_internal.c b/src/xen/xend_internal.c
> index 1f8b106..9d95291 100644
> --- a/src/xen/xend_internal.c
> +++ b/src/xen/xend_internal.c
> @@ -4411,7 +4411,7 @@ xenDaemonDomainSetAutostart(virDomainPtr domain,
>      if (autonode) {
>          const char *val = (autonode->u.s.car->kind == SEXPR_VALUE
>                             ? autonode->u.s.car->u.value : NULL);
> -        if (!STREQ(val, "ignore") && !STREQ(val, "start")) {
> +        if (!val || (!STREQ(val, "ignore") && !STREQ(val, "start"))) {
>              virXendError(domain->conn, VIR_ERR_INTERNAL_ERROR,
>                           "%s", _("unexpected value from on_xend_start"));
>              goto error;

  Okay, I didn't see that, the change was a bit complex :-) thanks for
double checking that quickly !

    ACK,

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