fix(esp_http_client): check http_parser errno after execute to avoid DoS loop

This commit is contained in:
nilesh.kale
2026-07-13 12:10:15 +05:30
parent e1b1969b8a
commit edb3f9daf1
3 changed files with 22 additions and 2 deletions
@@ -649,6 +649,12 @@ static int parse_block(http_parser *parser, size_t offset, size_t length)
ESP_LOGW(TAG, LOG_FMT("incomplete (%"NEWLIB_NANO_COMPAT_FORMAT"/%"NEWLIB_NANO_COMPAT_FORMAT") with parser error = %d"),
NEWLIB_NANO_COMPAT_CAST(nparsed), NEWLIB_NANO_COMPAT_CAST(length), parser->http_errno);
return -1;
} else if (HTTP_PARSER_ERRNO(parser) != HPE_OK) {
/* http_parser error */
data->error = HTTPD_400_BAD_REQUEST;
data->status = PARSING_FAILED;
ESP_LOGE(TAG, LOG_FMT("parser error: %s"), http_errno_description(HTTP_PARSER_ERRNO(parser)));
return -1;
}
/* Return with the total length of the request packet