respondd-module-airtime: Add allocation checks to get_ifaces()

This commit is contained in:
Jan-Philipp Litza 2017-02-08 19:33:53 +01:00
parent 7b56f09e0f
commit f0a50e70a2
1 changed files with 5 additions and 0 deletions

View File

@ -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;