From: Michael Santos Date: Sat, 19 Mar 2011 15:11:03 +0000 (-0400) Subject: conf: increase buffer size to include spaces X-Git-Tag: lxc-0.7.5~46 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=95642a106820def0499d7aa24baa0d119d998700;p=thirdparty%2Flxc.git conf: increase buffer size to include spaces Signed-off-by: Michael Santos Signed-off-by: Daniel Lezcano --- diff --git a/src/lxc/conf.c b/src/lxc/conf.c index f73eaac8d..ae5b25925 100644 --- a/src/lxc/conf.c +++ b/src/lxc/conf.c @@ -205,14 +205,18 @@ static int run_script(const char *name, const char *section, va_start(ap, script); while ((p = va_arg(ap, char *))) - size += strlen(p); + size += strlen(p) + 1; va_end(ap); size += strlen(script); size += strlen(name); size += strlen(section); + size += 3; - buffer = alloca(size + 1); + if (size > INT_MAX) + return -1; + + buffer = alloca(size); if (!buffer) { ERROR("failed to allocate memory"); return -1;