Skip to content

Commit 4270482

Browse files
committed
fix(esp_http_server): Fix regression in httpd_cookie_key_value
Fix regression in httpd_cookie_key_value introduced by commit 4a47cf8
1 parent 68b583f commit 4270482

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

components/esp_http_server/src/httpd_parse.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1165,16 +1165,17 @@ esp_err_t static httpd_cookie_key_value(const char *cookie_str, const char *key,
11651165

11661166
/* Copy value to the caller's buffer. */
11671167
size_t copy_len = MIN(val_len, *val_size - 1);
1168+
1169+
/* Save actual Cookie value size (including terminating null) */
1170+
*val_size = val_len + 1;
1171+
11681172
/* If buffer length is smaller than needed, return truncation error */
11691173
if (copy_len < val_len) {
11701174
return ESP_ERR_HTTPD_RESULT_TRUNC;
11711175
}
11721176
memcpy(val, val_ptr, copy_len);
11731177
val[copy_len] = '\0';
11741178

1175-
/* Save actual Cookie value size (including terminating null) */
1176-
*val_size = copy_len + 1;
1177-
11781179
return ESP_OK;
11791180
}
11801181
ESP_LOGD(TAG, LOG_FMT("cookie %s not found"), key);

0 commit comments

Comments
 (0)