aboutsummaryrefslogtreecommitdiffstats
path: root/tools/console
diff options
context:
space:
mode:
authorKeir Fraser <keir.fraser@citrix.com>2009-06-17 07:23:06 +0100
committerKeir Fraser <keir.fraser@citrix.com>2009-06-17 07:23:06 +0100
commitac663c94f046161c0753ccf91455c3fbd3f50d1a (patch)
treef945cfe40711ba34f31c9bd99722b0debeabdca8 /tools/console
parentc12b25aa7ddb70cefacb119e1ff7573906a7284d (diff)
downloadxen-ac663c94f046161c0753ccf91455c3fbd3f50d1a.tar.gz
xen-ac663c94f046161c0753ccf91455c3fbd3f50d1a.tar.bz2
xen-ac663c94f046161c0753ccf91455c3fbd3f50d1a.zip
xenconsole: fix assumption about printed max domid length.
Also snprintf includes the final '\0' in the char count. Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Diffstat (limited to 'tools/console')
-rw-r--r--tools/console/client/main.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/tools/console/client/main.c b/tools/console/client/main.c
index b66baf8ae6..63e729acab 100644
--- a/tools/console/client/main.c
+++ b/tools/console/client/main.c
@@ -306,10 +306,10 @@ int main(int argc, char **argv)
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