WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-changelog

[Xen-changelog] [xen-unstable] libxenlight: avoid writing empty values t

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] [xen-unstable] libxenlight: avoid writing empty values to xenstore
From: Xen patchbot-unstable <patchbot-unstable@xxxxxxxxxxxxxxxxxxx>
Date: Tue, 01 Dec 2009 06:30:36 -0800
Delivery-date: Tue, 01 Dec 2009 06:31:29 -0800
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-id: BK change log <xen-changelog.lists.xensource.com>
List-post: <mailto:xen-changelog@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
Reply-to: xen-devel@xxxxxxxxxxxxxxxxxxx
Sender: xen-changelog-bounces@xxxxxxxxxxxxxxxxxxx
# HG changeset patch
# User Keir Fraser <keir.fraser@xxxxxxxxxx>
# Date 1259675053 0
# Node ID 8bd6d48300bd54e21ce0142041becc87074bde9e
# Parent  4c1831fabdd580a27b3075385e7c1e076e0dba7d
libxenlight: avoid writing empty values to xenstore

Prevent segmentation fault caused by empty values
in key-value pairs for the /vm/ subdirectory
when creating a pv domain.

Signed-off-by: Andres Lagar-Cavilla <andres@xxxxxxxxxxxxxxxx>
---
 tools/libxl/libxl.c |   22 ++++++++++++++--------
 1 files changed, 14 insertions(+), 8 deletions(-)

diff -r 4c1831fabdd5 -r 8bd6d48300bd tools/libxl/libxl.c
--- a/tools/libxl/libxl.c       Tue Dec 01 13:41:38 2009 +0000
+++ b/tools/libxl/libxl.c       Tue Dec 01 13:44:13 2009 +0000
@@ -191,6 +191,7 @@ int libxl_domain_build(struct libxl_ctx 
 int libxl_domain_build(struct libxl_ctx *ctx, libxl_domain_build_info *info, 
uint32_t domid, libxl_domain_build_state *state)
 {
     char **vments = NULL, **localents = NULL;
+    int i;
 
     build_pre(ctx, domid, info, state);
     if (info->hvm) {
@@ -203,14 +204,19 @@ int libxl_domain_build(struct libxl_ctx 
     } else {
         build_pv(ctx, domid, info, state);
         vments = libxl_calloc(ctx, 9, sizeof(char *));
-        vments[0] = "image/ostype";
-        vments[1] = "linux";
-        vments[2] = "image/kernel";
-        vments[3] = (char*) info->kernel;
-        vments[4] = "image/ramdisk";
-        vments[5] = (char*) info->u.pv.ramdisk;
-        vments[6] = "image/cmdline";
-        vments[7] = (char*) info->u.pv.cmdline;
+        i = 0;
+        vments[i++] = "image/ostype";
+        vments[i++] = "linux";
+        vments[i++] = "image/kernel";
+        vments[i++] = (char*) info->kernel;
+        if (info->u.pv.ramdisk) {
+            vments[i++] = "image/ramdisk";
+            vments[i++] = (char*) info->u.pv.ramdisk;
+        }
+        if (info->u.pv.cmdline) {
+            vments[i++] = "image/cmdline";
+            vments[i++] = (char*) info->u.pv.cmdline;
+        }
     }
     build_post(ctx, domid, info, state, vments, localents);
     return 0;

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog

<Prev in Thread] Current Thread [Next in Thread>