Ensure argv passed by createl to create is NULL terminated

Signed-off-by: Dwight Engen <dwight.engen@oracle.com>
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
This commit is contained in:
Dwight Engen 2012-11-26 12:18:13 -05:00 committed by Stéphane Graber
parent d95db067d2
commit 83cab6e068

View File

@ -686,13 +686,14 @@ static bool lxcapi_createl(struct lxc_container *c, char *t, ...)
if (!arg) if (!arg)
break; break;
nargs++; nargs++;
temp = realloc(args, nargs * sizeof(*args)); temp = realloc(args, (nargs+1) * sizeof(*args));
if (!temp) if (!temp)
goto out; goto out;
args = temp; args = temp;
args[nargs - 1] = arg; args[nargs - 1] = arg;
} }
va_end(ap); va_end(ap);
args[nargs] = NULL;
bret = c->create(c, t, args); bret = c->create(c, t, args);