CMSIS-Driver icon indicating copy to clipboard operation
CMSIS-Driver copied to clipboard

ESP32 ARM_WIFI_Initialize callback parameter not checked for NULL

Open xennex22 opened this issue 4 years ago • 1 comments

ARM_WIFI_Initialize takes a callback parameter cb_event. This is only used for ARM_WIFI_EVENT_AP_CONNECT and ARM_WIFI_EVENT_AP_DISCONNECT.

According to help the cb_event parameter can be NULL if no callback signals are required, however if AT_NOTIFY_STATION_CONNECTED or AT_NOTIFY_STATION_DISCONNECTED events are generated then the event callback is called without checking it if is NULL.

This occurs if the connection to the remote host drops for some reason.

https://github.com/ARM-software/CMSIS-Driver/blob/b2a6e81d3123b7532653c61edbbbda7c3e0d22ac/WiFi/ESP32/WiFi_ESP32.c#L375

Probably just needs a preceding test if(pCtrl->cb_event)

xennex22 avatar Dec 18 '21 23:12 xennex22

You are right again, this check shall be added. Thanks for taking the time and reporting this!

VladimirUmek avatar Dec 20 '21 11:12 VladimirUmek