]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
nl80211: Verify radar event attributes exist before using them
authorJouni Malinen <j@w1.fi>
Sat, 2 Nov 2013 18:39:57 +0000 (20:39 +0200)
committerJouni Malinen <j@w1.fi>
Sun, 3 Nov 2013 09:31:48 +0000 (11:31 +0200)
While these attributes may be expected to be present always, this needs
to be verified within driver_nl80211.c since we cannot depend on the
kernel/driver working correctly.

Signed-hostap: Jouni Malinen <j@w1.fi>

src/drivers/driver_nl80211.c

index a1c48373001b8640b51ebb50e56a2b3fef528f90..8bd0759639223ae38b321d925d8d9df4e288a20d 100644 (file)
@@ -2564,9 +2564,12 @@ static void nl80211_radar_event(struct wpa_driver_nl80211_data *drv,
        }
 
        /* Get VHT params */
-       data.dfs_event.chan_width =
-               convert2width(nla_get_u32(tb[NL80211_ATTR_CHANNEL_WIDTH]));
-       data.dfs_event.cf1 = nla_get_u32(tb[NL80211_ATTR_CENTER_FREQ1]);
+       if (tb[NL80211_ATTR_CHANNEL_WIDTH])
+               data.dfs_event.chan_width =
+                       convert2width(nla_get_u32(
+                                             tb[NL80211_ATTR_CHANNEL_WIDTH]));
+       if (tb[NL80211_ATTR_CENTER_FREQ1])
+               data.dfs_event.cf1 = nla_get_u32(tb[NL80211_ATTR_CENTER_FREQ1]);
        if (tb[NL80211_ATTR_CENTER_FREQ2])
                data.dfs_event.cf2 = nla_get_u32(tb[NL80211_ATTR_CENTER_FREQ2]);