]> git.kaiwu.me - nginx.git/commitdiff
Fixed possible buffer overrun in "too long header line" logging.
authorMaxim Dounin <mdounin@mdounin.ru>
Wed, 8 Oct 2014 13:16:04 +0000 (17:16 +0400)
committerMaxim Dounin <mdounin@mdounin.ru>
Wed, 8 Oct 2014 13:16:04 +0000 (17:16 +0400)
Additionally, ellipsis now always added to make it clear that
the header logged is incomplete.

Reported by Daniil Bondarev.

src/http/ngx_http_request.c

index 845ada322e32e31c4fa7661877dc424a4e3770db..560c5f512f5d551a31fb7b73455776d0ca9a53e7 100644 (file)
@@ -1227,12 +1227,11 @@ ngx_http_process_request_headers(ngx_event_t *rev)
 
                     if (len > NGX_MAX_ERROR_STR - 300) {
                         len = NGX_MAX_ERROR_STR - 300;
-                        p[len++] = '.'; p[len++] = '.'; p[len++] = '.';
                     }
 
                     ngx_log_error(NGX_LOG_INFO, c->log, 0,
-                                  "client sent too long header line: \"%*s\"",
-                                  len, r->header_name_start);
+                                "client sent too long header line: \"%*s...\"",
+                                len, r->header_name_start);
 
                     ngx_http_finalize_request(r,
                                             NGX_HTTP_REQUEST_HEADER_TOO_LARGE);