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

[libvirt] [PATCH 08/10] Fix missing OOM check in qemuParseCommandLine when splitting strings



From: "Daniel P. Berrange" <berrange redhat com>

The qemuParseCommandLine method did not check the return value of
virStringSplit to see if OOM had occurred. This lead to dereference
of a NULL pointer on OOM.

Signed-off-by: Daniel P. Berrange <berrange redhat com>
---
 src/qemu/qemu_command.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index 76d4e7c..733b653 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -11387,7 +11387,8 @@ qemuParseCommandLine(virCapsPtr qemuCaps,
              * Set os.machine only if first parameter lacks '=' or
              * contains explicit type='...' */
             WANT_VALUE();
-            list = virStringSplit(val, ",", 0);
+            if (!(list = virStringSplit(val, ",", 0)))
+                goto error;
             param = list[0];
 
             if (STRPREFIX(param, "type="))
-- 
1.8.3.1


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