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 <quic_jouni@quicinc.com>
This commit is contained in:
Jouni Malinen 2023-11-24 20:59:37 +02:00 committed by Jouni Malinen
parent 69ea73bfed
commit c8b4ad70b1

View file

@ -17,9 +17,12 @@
static int wpas_bssid_ignore_module_tests(void) static int wpas_bssid_ignore_module_tests(void)
{ {
struct wpa_supplicant wpa_s; struct wpa_supplicant wpa_s;
struct wpa_global global;
int ret = -1; int ret = -1;
os_memset(&wpa_s, 0, sizeof(wpa_s)); os_memset(&wpa_s, 0, sizeof(wpa_s));
os_memset(&global, 0, sizeof(global));
wpa_s.global = &global;
wpa_bssid_ignore_clear(&wpa_s); wpa_bssid_ignore_clear(&wpa_s);