Upstream: check format of CGI Status header

The CGI Status header is used as the HTTP status line if it has a
reason-phrase: its length should be > 3.

This change validates that the 4th character is a space, the only
allowed character in that position.

An addition to:
fa46a57199
This commit is contained in:
Ricardo Yanome 2024-12-10 19:30:31 +09:00
parent e28ef42b97
commit cc536f9ca9
No known key found for this signature in database
3 changed files with 3 additions and 3 deletions

View File

@ -2049,7 +2049,7 @@ ngx_http_fastcgi_process_header(ngx_http_request_t *r)
u->headers_in.status_n = status;
if (status_line->len > 3) {
if (status_line->len > 3 && status_line->data[3] == ' ') {
u->headers_in.status_line = *status_line;
}

View File

@ -1154,7 +1154,7 @@ ngx_http_scgi_process_header(ngx_http_request_t *r)
u->headers_in.status_n = status;
if (status_line->len > 3) {
if (status_line->len > 3 && status_line->data[3] == ' ') {
u->headers_in.status_line = *status_line;
}

View File

@ -1382,7 +1382,7 @@ ngx_http_uwsgi_process_header(ngx_http_request_t *r)
u->headers_in.status_n = status;
if (status_line->len > 3) {
if (status_line->len > 3 && status_line->data[3] == ' ') {
u->headers_in.status_line = *status_line;
}