From f949cbbeda5dea85810de9eee7613add709e9e91 Mon Sep 17 00:00:00 2001 From: Matt Wilson Date: Fri, 6 Sep 2013 12:52:04 -0700 Subject: 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 Cc: Stefano Stabellini Acked-By: Samuel Thibault [msw: split this patch from a larger patch from Ben, reworked to use strlen()] Signed-off-by: Matt Wilson --- extras/mini-os/blkfront.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'extras/mini-os/blkfront.c') diff --git a/extras/mini-os/blkfront.c b/extras/mini-os/blkfront.c index f4283a9578..70976f58d0 100644 --- a/extras/mini-os/blkfront.c +++ b/extras/mini-os/blkfront.c @@ -254,7 +254,7 @@ void shutdown_blkfront(struct blkfront_dev *dev) XenbusState state; char path[strlen(dev->backend) + 1 + 5 + 1]; - char nodename[strlen(dev->nodename) + 1 + 5 + 1]; + char nodename[strlen(dev->nodename) + strlen("/event-channel") + 1]; blkfront_sync(dev); -- cgit v1.2.3