mirror of
https://github.com/espressif/esp-idf.git
synced 2025-08-04 05:04:33 +02:00
Merge branch 'contrib/github_pr_16202' into 'master'
fix(esp_http_server): Fix regression in httpd_cookie_key_value introduced by commit 4a47cf8
(GitHub PR)
Closes IDFGH-15573
See merge request espressif/esp-idf!40230
This commit is contained in:
@@ -1165,6 +1165,10 @@ esp_err_t static httpd_cookie_key_value(const char *cookie_str, const char *key,
|
||||
|
||||
/* Copy value to the caller's buffer. */
|
||||
size_t copy_len = MIN(val_len, *val_size - 1);
|
||||
|
||||
/* Save actual Cookie value size (including terminating null) */
|
||||
*val_size = val_len + 1;
|
||||
|
||||
/* If buffer length is smaller than needed, return truncation error */
|
||||
if (copy_len < val_len) {
|
||||
return ESP_ERR_HTTPD_RESULT_TRUNC;
|
||||
@@ -1172,9 +1176,6 @@ esp_err_t static httpd_cookie_key_value(const char *cookie_str, const char *key,
|
||||
memcpy(val, val_ptr, copy_len);
|
||||
val[copy_len] = '\0';
|
||||
|
||||
/* Save actual Cookie value size (including terminating null) */
|
||||
*val_size = copy_len + 1;
|
||||
|
||||
return ESP_OK;
|
||||
}
|
||||
ESP_LOGD(TAG, LOG_FMT("cookie %s not found"), key);
|
||||
|
Reference in New Issue
Block a user