fix(httpd): validate buf_len in httpd_req_get_url_query_str_ptr()

This commit is contained in:
Ashish Sharma
2026-07-23 13:39:29 +08:00
parent 11897b8d4e
commit a0140c906e
2 changed files with 8 additions and 6 deletions
+3 -1
View File
@@ -1020,7 +1020,9 @@ esp_err_t httpd_req_get_url_query_str(httpd_req_t *r, char *buf, size_t buf_len)
esp_err_t httpd_req_get_url_query_str_ptr(httpd_req_t *r, const char **buf, size_t *buf_len)
{
if (r == NULL || buf == NULL) {
/* buf_len is an output pointer that is dereferenced below, so it must be
* validated along with the other arguments to avoid a NULL write */
if (r == NULL || buf == NULL || buf_len == NULL) {
return ESP_ERR_INVALID_ARG;
}