Skip to content

Commit 13a6dc5

Browse files
moonlight83340jhedberg
authored andcommitted
drivers: wifi: nrf_wifi: add NULL check in parse_sband
Ensure event is not NULL before accessing its members in nrf_wifi_parse_sband(). This adds a defensive check to avoid potential null dereference and ensures the function returns early when event data is invalid (i.e., zero channels or bitrates). Signed-off-by: Gaetan Perrot <[email protected]>
1 parent b0f1eb3 commit 13a6dc5

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

drivers/wifi/nrf_wifi/src/wpa_supp_if.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1516,7 +1516,7 @@ enum nrf_wifi_status nrf_wifi_parse_sband(
15161516
{
15171517
int count;
15181518

1519-
if (event && (event->nrf_wifi_n_bitrates == 0 || event->nrf_wifi_n_channels == 0)) {
1519+
if (event == NULL || (event->nrf_wifi_n_bitrates == 0 || event->nrf_wifi_n_channels == 0)) {
15201520
return NRF_WIFI_STATUS_FAIL;
15211521
}
15221522
memset(band, 0, sizeof(*band));

0 commit comments

Comments
 (0)