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

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

 



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@xxxxxxxxxx>
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;
--
1.7.0.233.g05e1a

--
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]