Commit 358afd84 by Serge Hallyn

lxcapi_get_interfaces and lxcapi_get_ips: stricter read check

Coverity warns of the danger of a short read otherwise. (Untested, but should be correct; Tossing over to you :) Signed-off-by: 's avatarSerge Hallyn <serge.hallyn@ubuntu.com> Cc: S.Çağlar Onur <caglar@10ur.org> Acked-by: 's avatarS.Çağlar Onur <caglar@10ur.org>
parent b0f0932a
......@@ -1556,7 +1556,7 @@ static char** lxcapi_get_interfaces(struct lxc_container *c)
/* close the write-end of the pipe */
close(pipefd[1]);
while (read(pipefd[0], &interface, IFNAMSIZ) > 0) {
while (read(pipefd[0], &interface, IFNAMSIZ) == IFNAMSIZ) {
if (array_contains(&interfaces, interface, count))
continue;
......@@ -1676,7 +1676,7 @@ static char** lxcapi_get_ips(struct lxc_container *c, const char* interface, con
/* close the write-end of the pipe */
close(pipefd[1]);
while (read(pipefd[0], &address, INET6_ADDRSTRLEN) > 0) {
while (read(pipefd[0], &address, INET6_ADDRSTRLEN) == INET6_ADDRSTRLEN) {
if(!add_to_array(&addresses, address, count))
ERROR("PARENT: add_to_array failed");
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