Commit 4b235800 authored by puuu's avatar puuu Committed by Damien George
Browse files

esp8266/modnetwork: In connect, fix potential buffer overflows.

parent 162a0f94
......@@ -102,13 +102,13 @@ STATIC mp_obj_t esp_connect(mp_uint_t n_args, const mp_obj_t *args) {
if (n_args > 1) {
p = mp_obj_str_get_data(args[1], &len);
len = MIN(len, sizeof(config.ssid));
memcpy(config.ssid, p, len);
if (n_args > 2) {
p = mp_obj_str_get_data(args[2], &len);
} else {
p = "";
len = MIN(len, sizeof(config.password));
memcpy(config.password, p, len);
}
memcpy(config.password, p, len);
error_check(wifi_station_set_config(&config), "Cannot set STA config");
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment