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>
This commit is contained in:
Gaetan Perrot 2025-07-08 16:27:20 +09:00 committed by Daniel DeGrasse
parent b6a5202e55
commit cd855104f2

View File

@ -69,13 +69,15 @@ int hostapd_send_wifi_mgmt_ap_sta_event(struct hostapd_iface *ap_ctx,
void *data)
{
struct sta_info *sta = data;
char *ifname = ap_ctx->bss[0]->conf->iface;
char *ifname;
struct wifi_ap_sta_info sta_info = { 0 };
if (!ap_ctx || !sta) {
return -EINVAL;
}
ifname = ap_ctx->bss[0]->conf->iface;
memcpy(sta_info.mac, sta->addr, sizeof(sta_info.mac));
if (event == NET_EVENT_WIFI_CMD_AP_STA_CONNECTED) {