From 993eb12407f26a8f4fa34153749588074fb09d3a Mon Sep 17 00:00:00 2001 From: Jouni Malinen Date: Sun, 8 May 2022 00:27:51 +0300 Subject: [PATCH] FST: Make sure get_hw_modes() callback is set for hostapd It looks like fst_wpa_obj::get_hw_modes would have been left uninitialized in hostapd. It is not obviously clear why this would not have caused issues earlier, but in any case, better make this set properly to allow unexpected behavior should that function pointer ever be used. Signed-off-by: Jouni Malinen --- src/ap/hostapd.c | 12 ++++++++++++ wpa_supplicant/wpa_supplicant.c | 1 + 2 files changed, 13 insertions(+) diff --git a/src/ap/hostapd.c b/src/ap/hostapd.c index ef53c41df..122d1660f 100644 --- a/src/ap/hostapd.c +++ b/src/ap/hostapd.c @@ -1784,6 +1784,16 @@ static void fst_hostapd_get_channel_info_cb(void *ctx, } +static int fst_hostapd_get_hw_modes_cb(void *ctx, + struct hostapd_hw_modes **modes) +{ + struct hostapd_data *hapd = ctx; + + *modes = hapd->iface->hw_features; + return hapd->iface->num_hw_features; +} + + static void fst_hostapd_set_ies_cb(void *ctx, const struct wpabuf *fst_ies) { struct hostapd_data *hapd = ctx; @@ -1876,9 +1886,11 @@ static const u8 * fst_hostapd_get_peer_next(void *ctx, void fst_hostapd_fill_iface_obj(struct hostapd_data *hapd, struct fst_wpa_obj *iface_obj) { + os_memset(iface_obj, 0, sizeof(*iface_obj)); iface_obj->ctx = hapd; iface_obj->get_bssid = fst_hostapd_get_bssid_cb; iface_obj->get_channel_info = fst_hostapd_get_channel_info_cb; + iface_obj->get_hw_modes = fst_hostapd_get_hw_modes_cb; iface_obj->set_ies = fst_hostapd_set_ies_cb; iface_obj->send_action = fst_hostapd_send_action_cb; iface_obj->get_mb_ie = fst_hostapd_get_mb_ie_cb; diff --git a/wpa_supplicant/wpa_supplicant.c b/wpa_supplicant/wpa_supplicant.c index e16861886..15215c3b1 100644 --- a/wpa_supplicant/wpa_supplicant.c +++ b/wpa_supplicant/wpa_supplicant.c @@ -5964,6 +5964,7 @@ static const u8 * wpas_fst_get_peer_next(void *ctx, void fst_wpa_supplicant_fill_iface_obj(struct wpa_supplicant *wpa_s, struct fst_wpa_obj *iface_obj) { + os_memset(iface_obj, 0, sizeof(*iface_obj)); iface_obj->ctx = wpa_s; iface_obj->get_bssid = wpas_fst_get_bssid_cb; iface_obj->get_channel_info = wpas_fst_get_channel_info_cb;