Page 1 of 1

How does wifi scan handle SSID with embedded NULL bytes?

Posted: Sat Jul 02, 2022 4:47 pm
by hippo59
I believe this question was posted a while ago but I couldn't find any response ...

I'm using ESP-IDF version 4.4

IEEE 802.11 specifies that the WIFI SSID can be from 0-32 bytes with no restriction on the values. So, since it can contain zero valued bytes one cannot treat the SSID as a null terminated string. Rather, the SSID needs to be defined along the lines of

uint8_t ssid[32]
uint8_t ssid_length;

But the ESP32 wifi component stores the results of a scan in records of type wifi_ap_record_t where the SSID is simply defined as

uint8_t ssid[33]

and the wifi scan example code prints out the SSID assuming it's a string.

Are there any plans to fix this?

Thanks !!