comparison src/http/modules/ngx_http_fastcgi_module.c @ 4529:1ebec1d15a25

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.
author Maxim Dounin <mdounin@mdounin.ru>
date Thu, 15 Mar 2012 11:27:12 +0000
parents 14411ee4d89f
children 834049edae24
comparison
equal deleted inserted replaced
4528:00ccad19c53d 4529:1ebec1d15a25
1499 1499
1500 h->value.data = h->key.data + h->key.len + 1; 1500 h->value.data = h->key.data + h->key.len + 1;
1501 h->lowcase_key = h->key.data + h->key.len + 1 1501 h->lowcase_key = h->key.data + h->key.len + 1
1502 + h->value.len + 1; 1502 + h->value.len + 1;
1503 1503
1504 ngx_cpystrn(h->key.data, r->header_name_start, 1504 ngx_memcpy(h->key.data, r->header_name_start, h->key.len);
1505 h->key.len + 1); 1505 h->key.data[h->key.len] = '\0';
1506 ngx_cpystrn(h->value.data, r->header_start, 1506 ngx_memcpy(h->value.data, r->header_start, h->value.len);
1507 h->value.len + 1); 1507 h->value.data[h->value.len] = '\0';
1508 } 1508 }
1509 1509
1510 h->hash = r->header_hash; 1510 h->hash = r->header_hash;
1511 1511
1512 if (h->key.len == r->lowcase_index) { 1512 if (h->key.len == r->lowcase_index) {