aboutsummaryrefslogtreecommitdiffstats
path: root/extras/mini-os/console
diff options
context:
space:
mode:
authorMatt Wilson <msw@amazon.com>2013-09-06 12:52:04 -0700
committerIan Campbell <ian.campbell@citrix.com>2013-09-10 10:54:34 +0100
commitf949cbbeda5dea85810de9eee7613add709e9e91 (patch)
treeef6bcf11eb1c907657f7c66b8f904f8b8f8cb1db /extras/mini-os/console
parentde333b694591909787da54a40496fc82c8ba5b62 (diff)
downloadxen-f949cbbeda5dea85810de9eee7613add709e9e91.tar.gz
xen-f949cbbeda5dea85810de9eee7613add709e9e91.tar.bz2
xen-f949cbbeda5dea85810de9eee7613add709e9e91.zip
minios: correct char array allocation for xenbus paths
The char arrays used to hold xenbus paths have historically been allocated by manually counting the length longest string constants included in constructing the path. This has led to improperly sized buffers, both too large (with little consequence) and too small (which obviously causes problems). This patch corrects the instances where the length was incorrectly calculated by using strlen() on the longest string constant used in building a xenbus path. A follow-on clean-up patch will change all instances to use strlen(). Signed-off-by: Ben Cressey <bcressey@amazon.com> Cc: Stefano Stabellini <stefano.stabellini@eu.citrix.com> Acked-By: Samuel Thibault <samuel.thibault@ens-lyon.org> [msw: split this patch from a larger patch from Ben, reworked to use strlen()] Signed-off-by: Matt Wilson <msw@amazon.com>
Diffstat (limited to 'extras/mini-os/console')
-rw-r--r--extras/mini-os/console/xenbus.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/extras/mini-os/console/xenbus.c b/extras/mini-os/console/xenbus.c
index e65baf75a9..1ecfcc542e 100644
--- a/extras/mini-os/console/xenbus.c
+++ b/extras/mini-os/console/xenbus.c
@@ -158,7 +158,7 @@ done:
{
XenbusState state;
- char path[strlen(dev->backend) + 1 + 19 + 1];
+ char path[strlen(dev->backend) + strlen("/state") + 1];
snprintf(path, sizeof(path), "%s/state", dev->backend);
xenbus_watch_path_token(XBT_NIL, path, path, &dev->events);