Unverified Commit 96267159 by Christian Brauner Committed by Stéphane Graber

commands: avoid NULL pointer dereference

lxc_cmd_get_lxcpath() and lxc_cmd_get_name() both pass a nil pointer to fill_sock_name(). Make sure that they are not dereferenced. Signed-off-by: 's avatarChristian Brauner <christian.brauner@ubuntu.com>
parent f0213547
......@@ -74,14 +74,19 @@
lxc_log_define(lxc_commands, lxc);
static int fill_sock_name(char *path, int len, const char *name,
static int fill_sock_name(char *path, int len, const char *lxcname,
const char *lxcpath, const char *hashed_sock_name)
{
const char *name;
char *tmppath;
size_t tmplen;
uint64_t hash;
int ret;
name = lxcname;
if (!name)
name = "";
if (hashed_sock_name != NULL) {
ret = snprintf(path, len, "lxc/%s/command", hashed_sock_name);
if (ret < 0 || ret >= len) {
......
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