1
0
mirror of https://passt.top/passt synced 2024-06-29 22:42:46 +00:00

netlink: In nl_addr() and nl_route(), don't return before set request

Fixes: 22ed4467a4 ("treewide: Unchecked return value from library, CWE-252")
Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
This commit is contained in:
Stefano Brivio 2022-05-01 06:55:49 +02:00
parent 3c6ae62510
commit 3f2e7098ac

View File

@ -328,7 +328,7 @@ void nl_route(int ns, unsigned int ifi, sa_family_t af, void *gw)
req.nlh.nlmsg_flags |= NLM_F_DUMP;
}
if (set || (n = nl_req(ns, buf, &req, req.nlh.nlmsg_len)) < 0)
if ((n = nl_req(ns, buf, &req, req.nlh.nlmsg_len)) < 0 || set)
return;
nh = (struct nlmsghdr *)buf;
@ -435,7 +435,7 @@ void nl_addr(int ns, unsigned int ifi, sa_family_t af,
req.nlh.nlmsg_flags |= NLM_F_DUMP;
}
if (set || (n = nl_req(ns, buf, &req, req.nlh.nlmsg_len)) < 0)
if ((n = nl_req(ns, buf, &req, req.nlh.nlmsg_len)) < 0 || set)
return;
nh = (struct nlmsghdr *)buf;