Mercurial > hg > nginx-quic
comparison src/http/modules/ngx_http_proxy_module.c @ 4534:fb322541c548 stable-1.0
Merge of r4530, r4531: null character fixes.
*) Fixed incorrect ngx_cpystrn() usage in ngx_http_*_process_header().
This resulted in a disclosure of previously freed memory if upstream
server returned specially crafted response, potentially exposing
sensitive information.
Reported by Matthew Daley.
*) Headers with null character are now rejected.
Headers with NUL character aren't allowed by HTTP standard and may cause
various security problems. They are now unconditionally rejected.
author | Maxim Dounin <mdounin@mdounin.ru> |
---|---|
date | Thu, 15 Mar 2012 11:41:43 +0000 |
parents | 50143b8fb95f |
children |
comparison
equal
deleted
inserted
replaced
4533:65ff9ed7feb2 | 4534:fb322541c548 |
---|---|
1276 } | 1276 } |
1277 | 1277 |
1278 h->value.data = h->key.data + h->key.len + 1; | 1278 h->value.data = h->key.data + h->key.len + 1; |
1279 h->lowcase_key = h->key.data + h->key.len + 1 + h->value.len + 1; | 1279 h->lowcase_key = h->key.data + h->key.len + 1 + h->value.len + 1; |
1280 | 1280 |
1281 ngx_cpystrn(h->key.data, r->header_name_start, h->key.len + 1); | 1281 ngx_memcpy(h->key.data, r->header_name_start, h->key.len); |
1282 ngx_cpystrn(h->value.data, r->header_start, h->value.len + 1); | 1282 h->key.data[h->key.len] = '\0'; |
1283 ngx_memcpy(h->value.data, r->header_start, h->value.len); | |
1284 h->value.data[h->value.len] = '\0'; | |
1283 | 1285 |
1284 if (h->key.len == r->lowcase_index) { | 1286 if (h->key.len == r->lowcase_index) { |
1285 ngx_memcpy(h->lowcase_key, r->lowcase_header, h->key.len); | 1287 ngx_memcpy(h->lowcase_key, r->lowcase_header, h->key.len); |
1286 | 1288 |
1287 } else { | 1289 } else { |