mirror of
https://github.com/nodejs/node.git
synced 2025-08-15 13:48:44 +02:00
http: add maximum chunk extension size
PR-URL: https://github.com/nodejs-private/node-private/pull/518 Fixes: https://hackerone.com/reports/2233486 Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Marco Ippolito <marcoippolito54@gmail.com> Reviewed-By: Rafael Gonzaga <rafael.nunu@hotmail.com> CVE-ID: CVE-2024-22019
This commit is contained in:
parent
834ae3785b
commit
03a5c34a82
3 changed files with 159 additions and 4 deletions
|
@ -866,6 +866,11 @@ const requestHeaderFieldsTooLargeResponse = Buffer.from(
|
|||
'Connection: close\r\n\r\n', 'ascii',
|
||||
);
|
||||
|
||||
const requestChunkExtensionsTooLargeResponse = Buffer.from(
|
||||
`HTTP/1.1 413 ${STATUS_CODES[413]}\r\n` +
|
||||
'Connection: close\r\n\r\n', 'ascii',
|
||||
);
|
||||
|
||||
function socketOnError(e) {
|
||||
// Ignore further errors
|
||||
this.removeListener('error', socketOnError);
|
||||
|
@ -886,6 +891,9 @@ function socketOnError(e) {
|
|||
case 'HPE_HEADER_OVERFLOW':
|
||||
response = requestHeaderFieldsTooLargeResponse;
|
||||
break;
|
||||
case 'HPE_CHUNK_EXTENSIONS_OVERFLOW':
|
||||
response = requestChunkExtensionsTooLargeResponse;
|
||||
break;
|
||||
case 'ERR_HTTP_REQUEST_TIMEOUT':
|
||||
response = requestTimeoutResponse;
|
||||
break;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue