Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions radio.c
Original file line number Diff line number Diff line change
Expand Up @@ -399,6 +399,9 @@ esp_err_t espradio_set_country_eu_manual(void) {

esp_err_t espradio_sta_set_config(const char *ssid, int ssid_len,
const char *pwd, int pwd_len) {
if (ssid_len < 0 || pwd_len < 0) {
return ESP_ERR_INVALID_ARG;
}
wifi_config_t cfg;
memset(&cfg, 0, sizeof(cfg));
if (ssid_len > 32) ssid_len = 32;

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, this also uncovers the silent ignore for ssid/pass longer than expected being just truncated to 32/64 chars - wouldn't it be better to return error here also? (and probably check this in user code for nicer errors?)

Expand All @@ -413,6 +416,9 @@ esp_err_t espradio_sta_set_config(const char *ssid, int ssid_len,
esp_err_t espradio_ap_set_config(const char *ssid, int ssid_len,
const char *pwd, int pwd_len,
uint8_t channel, int auth_open) {
if (ssid_len < 0 || pwd_len < 0) {
return ESP_ERR_INVALID_ARG;
}
wifi_config_t cfg;
memset(&cfg, 0, sizeof(cfg));
if (ssid_len > 32) ssid_len = 32;
Expand Down
Loading