]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
nl80211: Check nla_parse_nested() result
authorJouni Malinen <quic_jouni@quicinc.com>
Thu, 5 Sep 2024 21:53:30 +0000 (00:53 +0300)
committerJouni Malinen <j@w1.fi>
Thu, 5 Sep 2024 22:06:32 +0000 (01:06 +0300)
This recently added instance did not verify that parsing of nested
attributes succeeded.

Fixes: 15bf093b5b48 ("hostapd: Fetch multiple radios information from the driver")
Signed-off-by: Jouni Malinen <quic_jouni@quicinc.com>
src/drivers/driver_nl80211_capa.c

index 1b3f82390d00648e345720ccedc3c244ab3441ed..c4a23d542e78401f04122b6b07838b09fe6ba7f6 100644 (file)
@@ -2754,10 +2754,9 @@ static int phy_multi_hw_info_parse(struct hostapd_multi_hw_info *hw_info,
                hw_info->hw_idx = nla_get_u32(radio_attr);
                return NL_OK;
        case NL80211_WIPHY_RADIO_ATTR_FREQ_RANGE:
-               nla_parse_nested(tb_freq, NL80211_WIPHY_RADIO_FREQ_ATTR_MAX,
-                                radio_attr, NULL);
-
-               if (!tb_freq[NL80211_WIPHY_RADIO_FREQ_ATTR_START] ||
+               if (nla_parse_nested(tb_freq, NL80211_WIPHY_RADIO_FREQ_ATTR_MAX,
+                                    radio_attr, NULL) ||
+                   !tb_freq[NL80211_WIPHY_RADIO_FREQ_ATTR_START] ||
                    !tb_freq[NL80211_WIPHY_RADIO_FREQ_ATTR_END])
                        return NL_STOP;