Skip to content

Commit

Permalink
Protect against negative frequency values (#326)
Browse files Browse the repository at this point in the history
  • Loading branch information
eandersson authored Sep 28, 2024
1 parent 4b67f1e commit 04e8a51
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions main/http_server/http_server.c
Original file line number Diff line number Diff line change
Expand Up @@ -290,10 +290,10 @@ static esp_err_t PATCH_update_settings(httpd_req_t * req)
if ((item = cJSON_GetObjectItem(root, "hostname")) != NULL) {
nvs_config_set_string(NVS_CONFIG_HOSTNAME, item->valuestring);
}
if ((item = cJSON_GetObjectItem(root, "coreVoltage")) != NULL) {
if ((item = cJSON_GetObjectItem(root, "coreVoltage")) != NULL && item->valueint > 0) {
nvs_config_set_u16(NVS_CONFIG_ASIC_VOLTAGE, item->valueint);
}
if ((item = cJSON_GetObjectItem(root, "frequency")) != NULL) {
if ((item = cJSON_GetObjectItem(root, "frequency")) != NULL && item->valueint > 0) {
nvs_config_set_u16(NVS_CONFIG_ASIC_FREQ, item->valueint);
}
if ((item = cJSON_GetObjectItem(root, "flipscreen")) != NULL) {
Expand Down

0 comments on commit 04e8a51

Please sign in to comment.