mirror of
https://github.com/espressif/esp-idf.git
synced 2025-08-14 22:16:46 +00:00
feat(https_server): Added checks to verify if uri is empty
Added the checks if the URI is empty for the funtions httpd_req_get_url_query_len and httpd_req_get_url_query_str in httpd_parser.c
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2018-2024 Espressif Systems (Shanghai) CO LTD
|
||||
* SPDX-FileCopyrightText: 2018-2025 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
@@ -920,6 +920,11 @@ size_t httpd_req_get_url_query_len(httpd_req_t *r)
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (r->uri[0] == '\0') {
|
||||
ESP_LOGD(TAG, "uri is empty");
|
||||
return 0;
|
||||
}
|
||||
|
||||
struct httpd_req_aux *ra = r->aux;
|
||||
struct http_parser_url *res = &ra->url_parse_res;
|
||||
|
||||
@@ -940,6 +945,11 @@ esp_err_t httpd_req_get_url_query_str(httpd_req_t *r, char *buf, size_t buf_len)
|
||||
return ESP_ERR_HTTPD_INVALID_REQ;
|
||||
}
|
||||
|
||||
if (r->uri[0] == '\0') {
|
||||
ESP_LOGD(TAG, "uri is empty");
|
||||
return ESP_FAIL;
|
||||
}
|
||||
|
||||
struct httpd_req_aux *ra = r->aux;
|
||||
struct http_parser_url *res = &ra->url_parse_res;
|
||||
|
||||
|
Reference in New Issue
Block a user