summaryrefslogtreecommitdiff
path: root/proto_nlmsg.c
diff options
context:
space:
mode:
Diffstat (limited to 'proto_nlmsg.c')
-rw-r--r--proto_nlmsg.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/proto_nlmsg.c b/proto_nlmsg.c
index 93c52b9..c9238c8 100644
--- a/proto_nlmsg.c
+++ b/proto_nlmsg.c
@@ -293,6 +293,9 @@ static void rtnl_print_ifinfo(struct nlmsghdr *hdr)
char if_addr[64] = {};
char *af_link = "unknown";
+ if (hdr->nlmsg_len < NLMSG_LENGTH(sizeof(*ifi)))
+ return;
+
if (ifi->ifi_family == AF_UNSPEC)
af_link = "unspec";
else if (ifi->ifi_family == AF_BRIDGE)
@@ -398,6 +401,9 @@ static void rtnl_print_ifaddr(struct nlmsghdr *hdr)
char addr_str[256];
char flags[256];
+ if (hdr->nlmsg_len < NLMSG_LENGTH(sizeof(*ifa)))
+ return;
+
tprintf(" [ Address Family %d (%s%s%s)", ifa->ifa_family,
colorize_start(bold),
addr_family2str(ifa->ifa_family),
@@ -555,6 +561,9 @@ static void rtnl_print_route(struct nlmsghdr *hdr)
char addr_str[256];
char flags[256];
+ if (hdr->nlmsg_len < NLMSG_LENGTH(sizeof(*rtm)))
+ return;
+
tprintf(" [ Route Family %d (%s%s%s)", rtm->rtm_family,
colorize_start(bold),
addr_family2str(rtm->rtm_family),
@@ -698,6 +707,9 @@ static void rtnl_print_neigh(struct nlmsghdr *hdr)
char states[256];
char flags[256];
+ if (hdr->nlmsg_len < NLMSG_LENGTH(sizeof(*ndm)))
+ return;
+
tprintf(" [ Neigh Family %d (%s%s%s)", ndm->ndm_family,
colorize_start(bold),
addr_family2str(ndm->ndm_family),