summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorJo-Philipp Wich <jo@mein.io>2022-06-08 10:57:22 +0200
committerGitHub <noreply@github.com>2022-06-08 10:57:22 +0200
commite43eb40aff6ff9c4dea56546a278b636eb5f40fd (patch)
tree8d410bf918f3520084a0082f446429396782f80e
parent86111edb87ce42e956c9abc3711c8309e7960501 (diff)
parent1347440421718d1207e0b53158514737010665e9 (diff)
Merge pull request #80 from jow-/rtnl-fix-leftover-bytes
rtnl: avoid stray "netlink: %d bytes leftover after parsing attributes."
-rw-r--r--lib/rtnl.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/lib/rtnl.c b/lib/rtnl.c
index b6a3e38..3b8d6cc 100644
--- a/lib/rtnl.c
+++ b/lib/rtnl.c
@@ -1345,10 +1345,13 @@ uc_nl_convert_attrs(struct nl_msg *msg, void *buf, size_t buflen, size_t headsiz
if (!tb)
return false;
- if (buflen > headsize)
- nla_parse(tb, maxattr, buf + headsize, buflen - headsize, NULL);
- else
+ if (buflen > headsize) {
+ if (maxattr)
+ nla_parse(tb, maxattr, buf + headsize, buflen - headsize, NULL);
+ }
+ else {
structlen = buflen;
+ }
for (i = 0; i < nattrs; i++) {
if (attrs[i].attr == 0 && (uintptr_t)attrs[i].auxdata >= structlen)