Do not allow trailers to end with bare LF

This commit is contained in:
Demi Marie Obenour 2025-06-10 15:16:58 -04:00
parent 7032a60fa0
commit 9950dfbc94

View File

@ -2458,22 +2458,17 @@ before_semi:
goto invalid;
case sw_trailer:
switch (ch) {
case CR:
if (ch == CR) {
state = sw_trailer_almost_done;
break;
case LF:
goto done;
default:
if (ngx_http_token_char(ch)) {
state = sw_trailer_name;
r->lowcase_index = 1;
r->lowcase_header[0] = (ch | 0x20);
break;
}
goto invalid;
}
break;
if (ngx_http_token_char(ch)) {
state = sw_trailer_name;
r->lowcase_index = 1;
r->lowcase_header[0] = (ch | 0x20);
break;
}
goto invalid;
case sw_trailer_almost_done:
if (ch == LF) {
@ -2518,8 +2513,7 @@ before_semi:
state = sw_trailer_header_almost_done;
break;
}
/* fall through */
goto invalid;
case sw_trailer_header_almost_done:
if (ch == LF) {