mirror of
https://github.com/espressif/esp-idf.git
synced 2025-08-04 05:04:33 +02:00
fix(esp_http_server): Fix regression in httpd_cookie_key_value
Fix regression in httpd_cookie_key_value introduced by commit 4a47cf8
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. */
|
/* Copy value to the caller's buffer. */
|
||||||
size_t copy_len = MIN(val_len, *val_size - 1);
|
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 buffer length is smaller than needed, return truncation error */
|
||||||
if (copy_len < val_len) {
|
if (copy_len < val_len) {
|
||||||
return ESP_ERR_HTTPD_RESULT_TRUNC;
|
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);
|
memcpy(val, val_ptr, copy_len);
|
||||||
val[copy_len] = '\0';
|
val[copy_len] = '\0';
|
||||||
|
|
||||||
/* Save actual Cookie value size (including terminating null) */
|
|
||||||
*val_size = copy_len + 1;
|
|
||||||
|
|
||||||
return ESP_OK;
|
return ESP_OK;
|
||||||
}
|
}
|
||||||
ESP_LOGD(TAG, LOG_FMT("cookie %s not found"), key);
|
ESP_LOGD(TAG, LOG_FMT("cookie %s not found"), key);
|
||||||
|
Reference in New Issue
Block a user