From: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
To: xen-devel <xen-devel@lists.xensource.com>
Subject: [PATCH] fix domid length in xenconsole
Date: Tue, 16 Jun 2009 16:44:22 +0100 [thread overview]
Message-ID: <4A37BDD6.2050505@eu.citrix.com> (raw)
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@eu.citrix.com>
---
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
reply other threads:[~2009-06-16 15:44 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4A37BDD6.2050505@eu.citrix.com \
--to=stefano.stabellini@eu.citrix.com \
--cc=xen-devel@lists.xensource.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.