coverity: #1425883

ensure \0-termination Signed-off-by: 's avatarChristian Brauner <christian.brauner@ubuntu.com>
parent 5a7c6e01
...@@ -1618,11 +1618,14 @@ static char** lxcapi_get_interfaces(struct lxc_container *c) ...@@ -1618,11 +1618,14 @@ static char** lxcapi_get_interfaces(struct lxc_container *c)
close(pipefd[1]); close(pipefd[1]);
while (read(pipefd[0], &interface, IFNAMSIZ) == IFNAMSIZ) { while (read(pipefd[0], &interface, IFNAMSIZ) == IFNAMSIZ) {
interface[IFNAMSIZ - 1] = '\0';
if (array_contains(&interfaces, interface, count)) if (array_contains(&interfaces, interface, count))
continue; continue;
if(!add_to_array(&interfaces, interface, count)) if(!add_to_array(&interfaces, interface, count))
ERROR("PARENT: add_to_array failed"); ERROR("Failed to add \"%s\" to array", interface);
count++; count++;
} }
......
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