Skip to content

Commit

Permalink
Fix for securing wlan.ini (#1509)
Browse files Browse the repository at this point in the history
* Fix for securing wlan.ini

* Fixing error with ' instead of "

* Changing to errorcode 403

* maybe strcmp instead of regular ==

Co-authored-by: Pär Hedberg <par.hedberg@nordicmedtest.se>
  • Loading branch information
parhedberg and Pär Hedberg authored Dec 7, 2022
1 parent f4d0865 commit 39019e9
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions code/components/jomjol_fileserver_ota/server_file.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -831,6 +831,12 @@ static esp_err_t delete_post_handler(httpd_req_t *req)
return ESP_FAIL;
}

if (strcmp(filename, "wlan.ini") == 0) {
ESP_LOGE(TAG, "Trying to delete protected file : %s", filename);
httpd_resp_send_err(req, HTTPD_403_FORBIDDEN, "Not allowed to delete wlan.ini");
return ESP_FAIL;
}

if (stat(filepath, &file_stat) == -1) {
ESP_LOGE(TAG, "File does not exist: %s", filename);
/* Respond with 400 Bad Request */
Expand Down

0 comments on commit 39019e9

Please sign in to comment.