mirror of
https://github.com/espressif/esp-idf.git
synced 2026-10-01 10:40:47 +03:00
fix(esp_http_client): check http_parser errno after execute to avoid DoS loop
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user