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.

Signed-off-by: Cole Robinson <crobi...@redhat.com>
---
 src/util.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/src/util.c b/src/util.c
index d8ab37f..8b746f5 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;
-- 
1.6.3.2

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

Reply via email to