]> xenbits.xensource.com Git - people/sstabellini/xen-unstable.git/.git/commitdiff
libxl: Don't dereference null new_name pointer in libxl_domain_rename()
authorEuan Harris <euan.harris@citrix.com>
Mon, 1 Dec 2014 14:27:06 +0000 (14:27 +0000)
committerIan Campbell <ian.campbell@citrix.com>
Tue, 2 Dec 2014 14:18:57 +0000 (14:18 +0000)
libxl__domain_rename() unconditionally dereferences its new_name
parameter, to check whether it is an empty string.   Add a check to
avoid a segfault if new_name is null.

Signed-off-by: Euan Harris <euan.harris@citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
tools/libxl/libxl.c

index c50c3233762bd2be580f83717e99af193e2aa22d..74c00dc4148d2f67e2afe94c17eefd3abf69f766 100644 (file)
@@ -385,6 +385,13 @@ int libxl__domain_rename(libxl__gc *gc, uint32_t domid,
         }
     }
 
+    if (!new_name) {
+        LIBXL__LOG(ctx, LIBXL__LOG_ERROR,
+                        "new domain name not specified");
+        rc = ERROR_INVAL;
+        goto x_rc;
+    }
+
     if (new_name[0]) {
         /* nonempty names must be unique */
         uint32_t domid_e;