[Date Prev][Date Next] [Thread Prev][Thread Next]
[Thread Index]
[Date Index]
[Author Index]
[libvirt] [PATCH] Fix segfault if storage pool has no type attribute (possibly others)
- From: Cole Robinson <crobinso redhat com>
- To: libvir-list redhat com
- Cc:
- Subject: [libvirt] [PATCH] Fix segfault if storage pool has no type attribute (possibly others)
- Date: Fri, 19 Jun 2009 12:36:51 -0400
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 <crobinso 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
[Date Prev][Date Next] [Thread Prev][Thread Next]
[Thread Index]
[Date Index]
[Author Index]