comparison src/http/modules/ngx_http_uwsgi_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 9c3a2fc3c460
children 834049edae24
comparison
equal deleted inserted replaced
4528:00ccad19c53d 4529:1ebec1d15a25
979 } 979 }
980 980
981 h->value.data = h->key.data + h->key.len + 1; 981 h->value.data = h->key.data + h->key.len + 1;
982 h->lowcase_key = h->key.data + h->key.len + 1 + h->value.len + 1; 982 h->lowcase_key = h->key.data + h->key.len + 1 + h->value.len + 1;
983 983
984 ngx_cpystrn(h->key.data, r->header_name_start, h->key.len + 1); 984 ngx_memcpy(h->key.data, r->header_name_start, h->key.len);
985 ngx_cpystrn(h->value.data, r->header_start, h->value.len + 1); 985 h->key.data[h->key.len] = '\0';
986 ngx_memcpy(h->value.data, r->header_start, h->value.len);
987 h->value.data[h->value.len] = '\0';
986 988
987 if (h->key.len == r->lowcase_index) { 989 if (h->key.len == r->lowcase_index) {
988 ngx_memcpy(h->lowcase_key, r->lowcase_header, h->key.len); 990 ngx_memcpy(h->lowcase_key, r->lowcase_header, h->key.len);
989 991
990 } else { 992 } else {