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] xl: Fix adding additional config cmdline

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] [xen-unstable] xl: Fix adding additional config cmdline parameters
From: Xen patchbot-unstable <patchbot-unstable@xxxxxxxxxxxxxxxxxxx>
Date: Fri, 10 Sep 2010 14:40:44 -0700
Delivery-date: Fri, 10 Sep 2010 14:44:33 -0700
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 Andre Przywara <andre.przywara@xxxxxxx>
# Date 1284141467 -3600
# Node ID 862a07d67ea3a589da79a418941347c62a8aa604
# Parent  a9f272d4ab4f121e223b9533b5c9d3489f733597
xl: Fix adding additional config cmdline parameters

When checking the size of the buffer we hold for additional
config parameters passed on the command line we should take the
size of the to-be-added string into account. While at it, rework
the implementation to be cleaner and safer.

Signed-off-by: Andre Przywara <andre.przywara@xxxxxxx>
Signed-off-by: Ian Jackson <ian.jackson@xxxxxxxxxxxxx>
---
 tools/libxl/xl_cmdimpl.c |   14 +++++---------
 1 files changed, 5 insertions(+), 9 deletions(-)

diff -r a9f272d4ab4f -r 862a07d67ea3 tools/libxl/xl_cmdimpl.c
--- a/tools/libxl/xl_cmdimpl.c  Fri Sep 10 18:57:28 2010 +0100
+++ b/tools/libxl/xl_cmdimpl.c  Fri Sep 10 18:57:47 2010 +0100
@@ -3179,21 +3179,17 @@ int main_create(int argc, char **argv)
         }
     }
 
-    memset(extra_config, 0, sizeof(extra_config));
-    while (optind < argc) {
-        if ((p = strchr(argv[optind], '='))) {
-            if (strlen(extra_config) + 1 < sizeof(extra_config)) {
-                if (strlen(extra_config))
-                    strcat(extra_config, "\n");
-                strcat(extra_config, argv[optind]);
-            }
+    extra_config[0] = '\0';
+    for (p = extra_config; optind < argc; optind++) {
+        if (strchr(argv[optind], '=') != NULL) {
+            p += snprintf(p, sizeof(extra_config) - (p - extra_config),
+                "%s\n", argv[optind]);
         } else if (!filename) {
             filename = argv[optind];
         } else {
             help("create");
             return 2;
         }
-        optind++;
     }
 
     memset(&dom_info, 0, sizeof(dom_info));

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

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-changelog] [xen-unstable] xl: Fix adding additional config cmdline parameters, Xen patchbot-unstable <=