diff src/http/modules/ngx_http_fastcgi_module.c @ 512:6557aef8a4b2 NGINX_0_8_8

nginx 0.8.8 *) Bugfix: in handling FastCGI headers split in records. *) Bugfix: a segmentation fault occurred in worker process, if a request was handled in two proxied or FastCGIed locations and a caching was enabled in the first location; the bug had appeared in 0.8.7.
author Igor Sysoev <http://sysoev.ru>
date Mon, 10 Aug 2009 00:00:00 +0400
parents 24b676623d4f
children 43cc6f0b77ce
line wrap: on
line diff
--- a/src/http/modules/ngx_http_fastcgi_module.c
+++ b/src/http/modules/ngx_http_fastcgi_module.c
@@ -1065,7 +1065,7 @@ ngx_http_fastcgi_reinit_request(ngx_http
 static ngx_int_t
 ngx_http_fastcgi_process_header(ngx_http_request_t *r)
 {
-    u_char                         *p, *start, *last, *part_start;
+    u_char                         *p, *start, *last, *part_start, *part_end;
     size_t                          size;
     ngx_str_t                      *status_line, line, *pattern;
     ngx_int_t                       rc, status;
@@ -1237,6 +1237,7 @@ ngx_http_fastcgi_process_header(ngx_http
         for ( ;; ) {
 
             part_start = u->buffer.pos;
+            part_end = u->buffer.last;
 
             rc = ngx_http_parse_header_line(r, &u->buffer, 1);
 
@@ -1437,7 +1438,11 @@ ngx_http_fastcgi_process_header(ngx_http
         part = ngx_array_push(f->split_parts);
 
         part->start = part_start;
-        part->end = u->buffer.last;
+        part->end = part_end;
+
+        if (u->buffer.pos < u->buffer.last) {
+            continue;
+        }
 
         return NGX_AGAIN;
     }