diff -Naurp nginx-0.8.41/src/http/modules/ngx_http_fastcgi_module.c nginx-0.8.41.oden/src/http/modules/ngx_http_fastcgi_module.c --- nginx-0.8.41/src/http/modules/ngx_http_fastcgi_module.c 2010-06-08 16:15:47.000000000 +0000 +++ nginx-0.8.41.oden/src/http/modules/ngx_http_fastcgi_module.c 2012-03-29 05:09:56.000000000 +0000 @@ -1453,10 +1453,10 @@ ngx_http_fastcgi_process_header(ngx_http h->lowcase_key = h->key.data + h->key.len + 1 + h->value.len + 1; - ngx_cpystrn(h->key.data, r->header_name_start, - h->key.len + 1); - ngx_cpystrn(h->value.data, r->header_start, - h->value.len + 1); + ngx_memcpy(h->key.data, r->header_name_start, h->key.len); + h->key.data[h->key.len] = '\0'; + ngx_memcpy(h->value.data, r->header_start, h->value.len); + h->value.data[h->value.len] = '\0'; } h->hash = r->header_hash; diff -Naurp nginx-0.8.41/src/http/modules/ngx_http_proxy_module.c nginx-0.8.41.oden/src/http/modules/ngx_http_proxy_module.c --- nginx-0.8.41/src/http/modules/ngx_http_proxy_module.c 2010-06-15 09:31:19.000000000 +0000 +++ nginx-0.8.41.oden/src/http/modules/ngx_http_proxy_module.c 2012-03-29 05:09:56.000000000 +0000 @@ -1510,8 +1510,10 @@ ngx_http_proxy_process_header(ngx_http_r h->value.data = h->key.data + h->key.len + 1; h->lowcase_key = h->key.data + h->key.len + 1 + h->value.len + 1; - ngx_cpystrn(h->key.data, r->header_name_start, h->key.len + 1); - ngx_cpystrn(h->value.data, r->header_start, h->value.len + 1); + ngx_memcpy(h->key.data, r->header_name_start, h->key.len); + h->key.data[h->key.len] = '\0'; + ngx_memcpy(h->value.data, r->header_start, h->value.len); + h->value.data[h->value.len] = '\0'; if (h->key.len == r->lowcase_index) { ngx_memcpy(h->lowcase_key, r->lowcase_header, h->key.len); diff -Naurp nginx-0.8.41/src/http/modules/ngx_http_uwsgi_module.c nginx-0.8.41.oden/src/http/modules/ngx_http_uwsgi_module.c --- nginx-0.8.41/src/http/modules/ngx_http_uwsgi_module.c 2010-06-08 19:33:53.000000000 +0000 +++ nginx-0.8.41.oden/src/http/modules/ngx_http_uwsgi_module.c 2012-03-29 05:10:03.000000000 +0000 @@ -1169,8 +1169,10 @@ ngx_http_uwsgi_process_header(ngx_http_r h->value.data = h->key.data + h->key.len + 1; h->lowcase_key = h->key.data + h->key.len + 1 + h->value.len + 1; - ngx_cpystrn(h->key.data, r->header_name_start, h->key.len + 1); - ngx_cpystrn(h->value.data, r->header_start, h->value.len + 1); + ngx_memcpy(h->key.data, r->header_name_start, h->key.len); + h->key.data[h->key.len] = '\0'; + ngx_memcpy(h->value.data, r->header_start, h->value.len); + h->value.data[h->value.len] = '\0'; if (h->key.len == r->lowcase_index) { ngx_memcpy(h->lowcase_key, r->lowcase_header, h->key.len); diff -Naurp nginx-0.8.41/src/http/ngx_http_parse.c nginx-0.8.41.oden/src/http/ngx_http_parse.c --- nginx-0.8.41/src/http/ngx_http_parse.c 2010-06-15 09:31:19.000000000 +0000 +++ nginx-0.8.41.oden/src/http/ngx_http_parse.c 2012-03-29 05:10:03.000000000 +0000 @@ -813,6 +813,10 @@ ngx_http_parse_header_line(ngx_http_requ break; } + if (ch == '\0') { + return NGX_HTTP_PARSE_INVALID_HEADER; + } + r->invalid_header = 1; break; @@ -875,6 +879,10 @@ ngx_http_parse_header_line(ngx_http_requ break; } + if (ch == '\0') { + return NGX_HTTP_PARSE_INVALID_HEADER; + } + r->invalid_header = 1; break; @@ -893,6 +901,8 @@ ngx_http_parse_header_line(ngx_http_requ r->header_start = p; r->header_end = p; goto done; + case '\0': + return NGX_HTTP_PARSE_INVALID_HEADER; default: r->header_start = p; state = sw_value; @@ -914,6 +924,8 @@ ngx_http_parse_header_line(ngx_http_requ case LF: r->header_end = p; goto done; + case '\0': + return NGX_HTTP_PARSE_INVALID_HEADER; } break; @@ -927,6 +939,8 @@ ngx_http_parse_header_line(ngx_http_requ break; case LF: goto done; + case '\0': + return NGX_HTTP_PARSE_INVALID_HEADER; default: state = sw_value; break;