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] Proactively check for NULL strings passed into xc_linx_b

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] Proactively check for NULL strings passed into xc_linx_build. Either do
From: Xen patchbot -unstable <patchbot-unstable@xxxxxxxxxxxxxxxxxxx>
Date: Tue, 10 Jan 2006 22:02:09 +0000
Delivery-date: Tue, 10 Jan 2006 22:08:58 +0000
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/cgi-bin/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/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 kaf24@xxxxxxxxxxxxxxxxxxxx
# Node ID c503c388797100b2492532fee4cbd48c71a85ce8
# Parent  d39fa3f09cb236321203d90651dc6ad245489b07
Proactively check for NULL strings passed into xc_linx_build.  Either do
the right thing or return error if detected.  A NULL cmdline, for example,
would currently generate a segfault.

Signed-off-by: Ben Thomas <bjthomas3@xxxxxxxxx>

diff -r d39fa3f09cb2 -r c503c3887971 tools/libxc/xc_linux_build.c
--- a/tools/libxc/xc_linux_build.c      Tue Jan 10 14:26:57 2006
+++ b/tools/libxc/xc_linux_build.c      Tue Jan 10 14:28:41 2006
@@ -693,8 +693,11 @@
         start_info->mod_start    = vinitrd_start;
         start_info->mod_len      = initrd_len;
     }
-    strncpy((char *)start_info->cmd_line, cmdline, MAX_GUEST_CMDLINE);
-    start_info->cmd_line[MAX_GUEST_CMDLINE-1] = '\0';
+    if ( cmdline != NULL )
+    {
+        strncpy((char *)start_info->cmd_line, cmdline, MAX_GUEST_CMDLINE);
+        start_info->cmd_line[MAX_GUEST_CMDLINE-1] = '\0';
+    }
     munmap(start_info, PAGE_SIZE);
 
     /* shared_info page starts its life empty. */
diff -r d39fa3f09cb2 -r c503c3887971 tools/libxc/xg_private.c
--- a/tools/libxc/xg_private.c  Tue Jan 10 14:26:57 2006
+++ b/tools/libxc/xg_private.c  Tue Jan 10 14:28:41 2006
@@ -16,6 +16,9 @@
     gzFile kernel_gfd = NULL;
     char *image = NULL;
     unsigned int bytes;
+
+    if ( filename == NULL )
+        goto out;
 
     if ( (kernel_fd = open(filename, O_RDONLY)) < 0 )
     {

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

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-changelog] Proactively check for NULL strings passed into xc_linx_build. Either do, Xen patchbot -unstable <=