Skip to content

Commit f6cd3d8

Browse files
moonlight83340krish2718
authored andcommitted
[nrf fromtree] modules: hostap: hapd_events: Fix possible null deference
Move usage of ap_ctx pointers after null checks to prevent potential crashes. Signed-off-by: Gaetan Perrot <[email protected]> (cherry picked from commit cd85510)
1 parent 46cbb1e commit f6cd3d8

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

modules/hostap/src/hapd_events.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,13 +62,15 @@ int hostapd_send_wifi_mgmt_ap_sta_event(struct hostapd_iface *ap_ctx,
6262
void *data)
6363
{
6464
struct sta_info *sta = data;
65-
char *ifname = ap_ctx->bss[0]->conf->iface;
65+
char *ifname;
6666
struct wifi_ap_sta_info sta_info = { 0 };
6767

6868
if (!ap_ctx || !sta) {
6969
return -EINVAL;
7070
}
7171

72+
ifname = ap_ctx->bss[0]->conf->iface;
73+
7274
memcpy(sta_info.mac, sta->addr, sizeof(sta_info.mac));
7375

7476
if (event == NET_EVENT_WIFI_CMD_AP_STA_CONNECTED) {

0 commit comments

Comments
 (0)