Fix off by one in nested attribute management.

Fixes segv in:
  tc qdisc show dev eth1
due to uninitialized attribute table.

Signed-off-by: Stephen Hemminger <[EMAIL PROTECTED]>
---
 lib/libnetlink.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/lib/libnetlink.c b/lib/libnetlink.c
index 12883fe..d13596f 100644
--- a/lib/libnetlink.c
+++ b/lib/libnetlink.c
@@ -632,6 +632,6 @@ int __parse_rtattr_nested_compat(struct rtattr *tb[], int 
max, struct rtattr *rt
                rta = RTA_DATA(rta) + RTA_ALIGN(len);
                return parse_rtattr_nested(tb, max, rta);
        }
-       memset(tb, 0, sizeof(struct rtattr *) * max);
+       memset(tb, 0, sizeof(struct rtattr *) * (max + 1));
        return 0;
 }
-- 
1.5.3.4

--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to