From f0a50e70a2a194522c40b742a2b9252f7cd62f04 Mon Sep 17 00:00:00 2001 From: Jan-Philipp Litza Date: Wed, 8 Feb 2017 19:33:53 +0100 Subject: [PATCH] respondd-module-airtime: Add allocation checks to get_ifaces() --- net/respondd-module-airtime/src/ifaces.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/net/respondd-module-airtime/src/ifaces.c b/net/respondd-module-airtime/src/ifaces.c index bfbd28e..926d3e4 100644 --- a/net/respondd-module-airtime/src/ifaces.c +++ b/net/respondd-module-airtime/src/ifaces.c @@ -12,12 +12,17 @@ static int iface_dump_handler(struct nl_msg *msg, void *arg) { nla_parse(tb, NL80211_ATTR_MAX, genlmsg_attrdata(gnlh, 0), genlmsg_attrlen(gnlh, 0), NULL); + if (!tb[NL80211_ATTR_WIPHY] || !tb[NL80211_ATTR_IFINDEX]) + goto skip; + wiphy = nla_get_u32(tb[NL80211_ATTR_WIPHY]); for (last_next = arg; *last_next != NULL; last_next = &(*last_next)->next) { if ((*last_next)->wiphy == wiphy) goto skip; } *last_next = malloc(sizeof(**last_next)); + if (!*last_next) + goto skip; (*last_next)->next = NULL; (*last_next)->ifx = nla_get_u32(tb[NL80211_ATTR_IFINDEX]); (*last_next)->wiphy = wiphy;