Commit cd855104 authored by Gaetan Perrot's avatar Gaetan Perrot Committed by Daniel DeGrasse
Browse files

modules: hostap: hapd_events: Fix possible null deference

Move usage of ap_ctx pointers after null checks to prevent potential
crashes.

Signed-off-by: default avatarGaetan Perrot <gaetan.perrot@spacecubics.com>
parent b6a5202e
Loading
Loading
Loading
Loading
+3 −1
Changes for modules/hostap/src/hapd_events.c: 3 added lines, 1 removed line.
Original line number Diff line number Diff line
@@ -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) {