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-devel

[Xen-devel] [PATCH] fix domid length in xenconsole

To: xen-devel <xen-devel@xxxxxxxxxxxxxxxxxxx>
Subject: [Xen-devel] [PATCH] fix domid length in xenconsole
From: Stefano Stabellini <stefano.stabellini@xxxxxxxxxxxxx>
Date: Tue, 16 Jun 2009 16:44:22 +0100
Delivery-date: Tue, 16 Jun 2009 08:40:33 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
User-agent: Thunderbird 2.0.0.14 (X11/20080505)
Hi all,
the last patch for xenconsole erroneously assumed that the max length
of a domid in char is 3 while is obviously 5; this patch fixes it.
Also snprintf includes the final '\0' in the char count.

Signed-off-by: Stefano Stabellini <stefano.stabellini@xxxxxxxxxxxxx>

---

diff -r 33894148c1fd tools/console/client/main.c
--- a/tools/console/client/main.c       Tue Jun 16 13:42:22 2009 +0100
+++ b/tools/console/client/main.c       Tue Jun 16 13:45:18 2009 +0100
@@ -306,10 +306,10 @@
        dom_path = xs_get_domain_path(xs, domid);
        if (dom_path == NULL)
                err(errno, "xs_get_domain_path()");
-       path = malloc(strlen(dom_path) + strlen("/serial/0/tty") + 3);
+       path = malloc(strlen(dom_path) + strlen("/serial/0/tty") + 5);
        if (path == NULL)
                err(ENOMEM, "malloc");
-       snprintf(path, strlen(dom_path) + strlen("/serial/0/tty") + 2, 
"%s/serial/%d/tty", dom_path, num);
+       snprintf(path, strlen(dom_path) + strlen("/serial/0/tty") + 5, 
"%s/serial/%d/tty", dom_path, num);
 
        /* FIXME consoled currently does not assume domain-0 doesn't have a
           console which is good when we break domain-0 up.  To keep us

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

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-devel] [PATCH] fix domid length in xenconsole, Stefano Stabellini <=