]> git.kaiwu.me - nginx.git/commitdiff
Mail: disabled handling of headers without a colon in auth_http
authorVadim Zhestikov <v.zhestikov@f5.com>
Wed, 28 Oct 2026 15:55:50 +0000 (08:55 -0700)
committerVadimZhestikov <108960056+VadimZhestikov@users.noreply.github.com>
Wed, 28 Oct 2026 17:08:44 +0000 (10:08 -0700)
Header names not followed by a colon and a value in an auth_http server
response were accepted as headers with an empty value, similarly to
ngx_http_parse_header_line().  With this change, such headers are
rejected with the "sent invalid header in response" error, and the
client gets the internal server error reply.

The problem appeared in 5192b3651 (0.1.38).

src/mail/ngx_mail_auth_http_module.c

index 3e5095a2d226b25c50f20acffe652956200d5e76..1b077a469305b575c85fd80f133460d52bbbb75d 100644 (file)
@@ -985,21 +985,6 @@ ngx_mail_auth_http_parse_header_line(ngx_mail_session_t *s,
                 break;
             }
 
-            if (ch == CR) {
-                ctx->header_name_end = p;
-                ctx->header_start = p;
-                ctx->header_end = p;
-                state = sw_almost_done;
-                break;
-            }
-
-            if (ch == LF) {
-                ctx->header_name_end = p;
-                ctx->header_start = p;
-                ctx->header_end = p;
-                goto done;
-            }
-
             return NGX_ERROR;
 
         /* space* before header value */