Commit 83cab6e0 by Dwight Engen Committed by Stéphane Graber

Ensure argv passed by createl to create is NULL terminated

parent d95db067
...@@ -686,13 +686,14 @@ static bool lxcapi_createl(struct lxc_container *c, char *t, ...) ...@@ -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);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment