[Libvirt-cim] [PATCH] (#3) Add check to ensure PoolID specified in NetRASD has valid format

Kaitlin Rupert kaitlin at linux.vnet.ibm.com
Sat Jun 27 00:59:09 UTC 2009


# HG changeset patch
# User Kaitlin Rupert <karupert at us.ibm.com>
# Date 1246064238 25200
# Node ID dd7ce21f085b956aa412af6f0665ab7e4eacfe07
# Parent  2f7ac06918f55d89f099447972b48d06b0140669
(#3) Add check to ensure PoolID specified in NetRASD has valid format

Updated from 2 t 3:
 -Rebase patch based on current sources

Updates from 1 to 2:
 -Add a proper subject and commit log to patch

Signed-off-by: Kaitlin Rupert <karupert at us.ibm.com>

diff -r 2f7ac06918f5 -r dd7ce21f085b src/Virt_VirtualSystemManagementService.c
--- a/src/Virt_VirtualSystemManagementService.c	Wed Jun 24 10:27:16 2009 -0700
+++ b/src/Virt_VirtualSystemManagementService.c	Fri Jun 26 17:57:18 2009 -0700
@@ -539,6 +539,7 @@
 {
         const char *val = NULL;
         const char *msg = NULL;
+        char *network = NULL;
 
         if (cu_get_str_prop(inst, "Address", &val) != CMPI_RC_OK) {
                 val = _net_rand_mac();
@@ -577,7 +578,14 @@
                         return "No NetworkPool specified no default available";
 
                 free(dev->dev.net.source);
-                dev->dev.net.source = name_from_pool_id(val);
+                network = name_from_pool_id(val);
+                if (network == NULL) {
+                        msg = "PoolID specified is not formatted properly";
+                        goto out;
+                }
+
+                dev->dev.net.source = strdup(network);
+
         } else
                 return "Invalid Network Type specified";
         free(dev->dev.net.model);
@@ -587,6 +595,7 @@
         else 
                 dev->dev.net.model = strdup(val);
  out:
+        free(network);
         return msg;
 }
 




More information about the Libvirt-cim mailing list