[PATCH] Fix segfault of hostapd_cli wps_config to non WPS AP
Masashi Honma
masashi.honma at gmail.com
Tue Oct 12 15:40:04 PDT 2021
Execution of "hostapd_cli wps_config" to non WPS AP causes segmentation fault.
$ hostapd_cli wps_config test WPA2PSK CCMP 12341234
wlp11s0: interface state UNINITIALIZED->COUNTRY_UPDATE
wlp11s0: interface state COUNTRY_UPDATE->ENABLED
wlp11s0: AP-ENABLED
WPA_TRACE: eloop SIGSEGV - START
[1]: ./git/hostap/hostapd/hostapd(+0x6c196) [0x55b270245196]
eloop_sigsegv_handler() ../src/utils/eloop.c:123
[2]: /lib/x86_64-linux-gnu/libc.so.6(+0x46210) [0x7f87574a7210]
[3]: ./git/hostap/hostapd/hostapd(hostapd_wps_config_ap+0x1a9) [0x55b2702ce349]
hostapd_wps_config_ap() ../src/ap/wps_hostapd.c:1970
[4]: ./git/hostap/hostapd/hostapd(+0x90a9f) [0x55b270269a9f]
hostapd_ctrl_iface_receive_process() ctrl_iface.c:3606
[5]: ./git/hostap/hostapd/hostapd(+0x94069) [0x55b27026d069]
hostapd_ctrl_iface_receive() ctrl_iface.c:4093
[6]: ./git/hostap/hostapd/hostapd(+0x6c6d3) [0x55b2702456d3]
eloop_sock_table_dispatch() ../src/utils/eloop.c:606
[7]: ./git/hostap/hostapd/hostapd(eloop_run+0x251) [0x55b2702461c1]
eloop_sock_table_dispatch() ../src/utils/eloop.c:597
eloop_run() ../src/utils/eloop.c:1229
[8]: ./git/hostap/hostapd/hostapd(main+0xd53) [0x55b270205773]
hostapd_global_run() main.c:447
main() main.c:892
[9]: /lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xf3) [0x7f87574880b3]
[10]: ./git/hostap/hostapd/hostapd(_start+0x2e) [0x55b2702058fe]
_start() (null):0
WPA_TRACE: eloop SIGSEGV - END
Aborted
Reported-by: Corentin Labbe <clabbe.montjoie at gmail.com>
Signed-off-by: Masashi Honma <masashi.honma at gmail.com>
---
src/ap/wps_hostapd.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/src/ap/wps_hostapd.c b/src/ap/wps_hostapd.c
index 9f22e39a2..4f1c76b7b 100644
--- a/src/ap/wps_hostapd.c
+++ b/src/ap/wps_hostapd.c
@@ -1964,6 +1964,11 @@ int hostapd_wps_config_ap(struct hostapd_data *hapd, const char *ssid,
cred.key_len = len / 2;
}
+ if (!hapd->wps) {
+ wpa_printf(MSG_ERROR, "WPS: WPS config does not exist");
+ return -1;
+ }
+
return wps_registrar_config_ap(hapd->wps->registrar, &cred);
}
--
2.25.1
More information about the Hostap
mailing list