From: Jouni Malinen Date: Sat, 2 Nov 2013 18:39:57 +0000 (+0200) Subject: nl80211: Verify radar event attributes exist before using them X-Git-Tag: hostap_2_1~661 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=884f1a3c654ec88f155cbcebb005371cc4970647;p=thirdparty%2Fhostap.git nl80211: Verify radar event attributes exist before using them 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 --- diff --git a/src/drivers/driver_nl80211.c b/src/drivers/driver_nl80211.c index a1c483730..8bd075963 100644 --- a/src/drivers/driver_nl80211.c +++ b/src/drivers/driver_nl80211.c @@ -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]);