Skip to contentSkip to conversation

libxl: Don't derefence null new_name pointer in libxl_domain_rename()

PATCH Applied Euan Harris 3 participants 4 messages Dec 1, 2014 – Dec 2, 2014

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 libxl: Don't derefence null new_name pointer in libxl_domain_rename()

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.

---
 tools/libxl/libxl.c |    7 +++++++
 1 files changed, 7 insertions(+), 0 deletions(-)
tools/libxl/libxl.c +7 -0
index f84f7c2..6e84b5d 100644
@@ -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;
Signature · 1 line
1.7.1
Acked-by on v1 1/1
#1 lore raw
Quoted 5 lines · Euan Harris

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.

I think this is a good fix to have for 4.5, Konrad CCd.

Quoted 22 lines
---
 tools/libxl/libxl.c |    7 +++++++
 1 files changed, 7 insertions(+), 0 deletions(-)
tools/libxl/libxl.c +7 -0
index f84f7c2..6e84b5d 100644
@@ -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;
#2 lore raw
Quoted 10 lines · Ian Campbell
Quoted 5 lines · Euan Harris

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.

I think this is a good fix to have for 4.5, Konrad CCd.

Quoted 25 lines
Quoted 23 lines
---
 tools/libxl/libxl.c |    7 +++++++
 1 files changed, 7 insertions(+), 0 deletions(-)
tools/libxl/libxl.c +7 -0
index f84f7c2..6e84b5d 100644
@@ -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;
Applied
#3 lore raw
Quoted 6 lines · Konrad Rzeszutek Wilk
Quoted 5 lines · Ian Campbell
Quoted 4 lines · Euan Harris

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.

Quoted 7 lines
Quoted 5 lines
Quoted 1 line

I think this is a good fix to have for 4.5, Konrad CCd.

Applied, fixing the typo in the subject as I went.