Skip to content

Commit 380a770

Browse files
moonlight83340krish2718
authored andcommitted
[nrf fromtree] modules: hostap: supp_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> (cherry picked from commit 8a565c0a2b8c12b1ea0298367a0ff525c1ae20b8)
1 parent 4044ebb commit 380a770

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

modules/hostap/src/supp_events.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -304,13 +304,15 @@ int supplicant_send_wifi_mgmt_ap_sta_event(void *ctx,
304304
{
305305
struct sta_info *sta = data;
306306
struct wpa_supplicant *ap_ctx = ctx;
307-
char *ifname = ap_ctx->ifname;
307+
char *ifname;
308308
struct wifi_ap_sta_info sta_info = { 0 };
309309

310310
if (!ap_ctx || !sta) {
311311
return -EINVAL;
312312
}
313313

314+
ifname = ap_ctx->ifname;
315+
314316
memcpy(sta_info.mac, sta->addr, sizeof(sta_info.mac));
315317

316318
if (event == NET_EVENT_WIFI_CMD_AP_STA_CONNECTED) {

0 commit comments

Comments
 (0)