From 884f1a3c654ec88f155cbcebb005371cc4970647 Mon Sep 17 00:00:00 2001 From: Jouni Malinen Date: Sat, 2 Nov 2013 20:39:57 +0200 Subject: [PATCH] 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 --- src/drivers/driver_nl80211.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) 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]);