]> git.ipfire.org Git - thirdparty/lxc.git/commitdiff
conf: increase buffer size to include spaces
authorMichael Santos <michael.santos@gmail.com>
Sat, 19 Mar 2011 15:11:03 +0000 (11:11 -0400)
committerDaniel Lezcano <dlezcano@fr.ibm.com>
Tue, 22 Mar 2011 14:04:52 +0000 (15:04 +0100)
Signed-off-by: Michael Santos <michael.santos@gmail.com>
Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
src/lxc/conf.c

index f73eaac8d5aea03f810b0f06ce30fbd23ec9b879..ae5b259252dc12a06627980db9d010d561ca30ab 100644 (file)
@@ -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;