lxccontainer: avoid NULL pointer dereference

In case the lxc command socket is hashed and the socket was created for a different path than the one we're currently querying lxc_cmd_get_{lxcpath,name}() can return NULL. The command socket path is hashed when len(lxcpath) > sizeof(sun_path) - 2. Signed-off-by: 's avatarChristian Brauner <christian.brauner@ubuntu.com>
parent 860e7c43
......@@ -4370,7 +4370,10 @@ int list_active_containers(const char *lxcpath, char ***nret,
*p2 = '\0';
if (is_hashed) {
if (strncmp(lxcpath, lxc_cmd_get_lxcpath(p), lxcpath_len) != 0)
char *recvpath = lxc_cmd_get_lxcpath(p);
if (!recvpath)
continue;
if (strncmp(lxcpath, recvpath, lxcpath_len) != 0)
continue;
p = lxc_cmd_get_name(p);
}
......
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