aboutgitcodebugslistschat
diff options
context:
space:
mode:
authorStefano Brivio <sbrivio@redhat.com>2022-05-01 06:55:49 +0200
committerStefano Brivio <sbrivio@redhat.com>2022-05-01 07:19:05 +0200
commit3f2e7098acef1027682212eb0e9895e7f6cb3af3 (patch)
tree0df891f1631fdd06ed16bc7dbe5860ef351b90f2
parent3c6ae625101aee6ddf94e0fd85ce3a9c9067c3bf (diff)
downloadpasst-3f2e7098acef1027682212eb0e9895e7f6cb3af3.tar
passt-3f2e7098acef1027682212eb0e9895e7f6cb3af3.tar.gz
passt-3f2e7098acef1027682212eb0e9895e7f6cb3af3.tar.bz2
passt-3f2e7098acef1027682212eb0e9895e7f6cb3af3.tar.lz
passt-3f2e7098acef1027682212eb0e9895e7f6cb3af3.tar.xz
passt-3f2e7098acef1027682212eb0e9895e7f6cb3af3.tar.zst
passt-3f2e7098acef1027682212eb0e9895e7f6cb3af3.zip
netlink: In nl_addr() and nl_route(), don't return before set request
Fixes: 22ed4467a413 ("treewide: Unchecked return value from library, CWE-252") Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
-rw-r--r--netlink.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/netlink.c b/netlink.c
index 78c1186..66a95e4 100644
--- a/netlink.c
+++ b/netlink.c
@@ -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;