summaryrefslogtreecommitdiff
path: root/fw/esp32
diff options
context:
space:
mode:
authorUros Majstorovic <majstor@majstor.org>2021-02-27 01:54:48 +0100
committerUros Majstorovic <majstor@majstor.org>2021-02-27 01:54:48 +0100
commitfe1d292f241bc7a024a9c20627f6300f3ebc433b (patch)
treea1f4a121c66da4961ae0afe8ff29ae37af2d40cc /fw/esp32
parent9d91377659c1ffc0f23373dc0b2ff4edaafac6a8 (diff)
wifi scan verifies length of ssid
Diffstat (limited to 'fw/esp32')
-rwxr-xr-xfw/esp32/components/eos/wifi.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/fw/esp32/components/eos/wifi.c b/fw/esp32/components/eos/wifi.c
index a20e076..7fae635 100755
--- a/fw/esp32/components/eos/wifi.c
+++ b/fw/esp32/components/eos/wifi.c
@@ -73,7 +73,8 @@ static void wifi_event_handler(void *arg, esp_event_base_t event_base, int32_t e
rbuf[0] = EOS_WIFI_MTYPE_SCAN;
p = rbuf + 1;
for (i=0; i<scan_n; i++) {
- len = strlen((char *)scan_r[i].ssid);
+ len = strnlen((char *)scan_r[i].ssid, 33);
+ if (len > 32) continue;
if (p - rbuf + len + 1 > EOS_NET_SIZE_BUF) break;
strcpy((char *)p, (char *)scan_r[i].ssid);
p += len + 1;