Skip to content

Commit cd85510

Browse files
moonlight83340danieldegrasse
authored andcommitted
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 <gaetan.perrot@spacecubics.com>
1 parent b6a5202 commit cd85510

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
@@ -69,13 +69,15 @@ int hostapd_send_wifi_mgmt_ap_sta_event(struct hostapd_iface *ap_ctx,
6969
void *data)
7070
{
7171
struct sta_info *sta = data;
72-
char *ifname = ap_ctx->bss[0]->conf->iface;
72+
char *ifname;
7373
struct wifi_ap_sta_info sta_info = { 0 };
7474

7575
if (!ap_ctx || !sta) {
7676
return -EINVAL;
7777
}
7878

79+
ifname = ap_ctx->bss[0]->conf->iface;
80+
7981
memcpy(sta_info.mac, sta->addr, sizeof(sta_info.mac));
8082

8183
if (event == NET_EVENT_WIFI_CMD_AP_STA_CONNECTED) {

0 commit comments

Comments
 (0)