From c8b4ad70b17bbe59a5dd4aa8d222387424c1702a Mon Sep 17 00:00:00 2001 From: Jouni Malinen Date: Fri, 24 Nov 2023 20:59:37 +0200 Subject: [PATCH] tests: Set wpa_s->global for module tests This is needed to avoid NULL pointer deferencing in wpa_supplicant_ctrl_iface_msg_cb() if any of the functions called from wpas_bssid_ignore_module_tests_() ends up using wpa_msg(). Signed-off-by: Jouni Malinen --- wpa_supplicant/wpas_module_tests.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/wpa_supplicant/wpas_module_tests.c b/wpa_supplicant/wpas_module_tests.c index ce5398cb8..9e7a57c4f 100644 --- a/wpa_supplicant/wpas_module_tests.c +++ b/wpa_supplicant/wpas_module_tests.c @@ -17,9 +17,12 @@ static int wpas_bssid_ignore_module_tests(void) { struct wpa_supplicant wpa_s; + struct wpa_global global; int ret = -1; os_memset(&wpa_s, 0, sizeof(wpa_s)); + os_memset(&global, 0, sizeof(global)); + wpa_s.global = &global; wpa_bssid_ignore_clear(&wpa_s);