From f7f52b15929e23f848d61f7bac8aa1b600fcda35 Mon Sep 17 00:00:00 2001 From: Cole Robinson Date: Mon, 22 Jun 2009 16:37:52 +0000 Subject: [PATCH] Fix segfault if storage pool has no type attribute (possibly others) virEnumFromString doesn't check for a NULL string, and will segfault if passed one. Lots of calling code protects against this, but at least /pool/@type parsing does not. --- ChangeLog | 15 +++++---------- src/util.c | 3 +++ 2 files changed, 8 insertions(+), 10 deletions(-) diff --git a/ChangeLog b/ChangeLog index e462c5e233..f8c157a8f0 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,23 +1,18 @@ +Mon Jun 22 12:35:34 EDT 2009 Cole Robinson + + * src/util.c: Fix segfault if storage pool has no type attribute + (possibly others) + Mon Jun 22 12:33:37 EDT 2009 Cole Robinson * src/qemu_driver.c: Fix memory reporting for inactive domains in the qemu driver. -Currently, 'info' will always report that mem = max mem. Make sure we -actually return the correct mem value. - Mon Jun 22 12:31:38 EDT 2009 Cole Robinson * src/storage_backend_fs.c src/storage_driver.c: Fix raw storage volume creation for allocation < capacity. -CreateXMLFrom changes accidentally caused all raw volume creation to be -fully allocated (as though allocation == capacity). Fix this. - -Also force CreateXMLFrom to maintain the previous behavior: sparseness -should still be maintained since we search for holes when copying, and the -clone behavior hasn't been tested with anything but the broken behavior. - Mon Jun 22 11:09:18 EDT 2009 Cole Robinson * src/test.c: Fix domain ID after redefining a running VM diff --git a/src/util.c b/src/util.c index d8ab37f7e4..8b746f5ae7 100644 --- a/src/util.c +++ b/src/util.c @@ -1622,6 +1622,9 @@ int virEnumFromString(const char *const*types, const char *type) { unsigned int i; + if (!type) + return -1; + for (i = 0 ; i < ntypes ; i++) if (STREQ(types[i], type)) return i; -- GitLab