Mercurial > hg > nginx
comparison src/http/modules/ngx_http_dav_module.c @ 6986:0cdee26605f3
Cleaned up r->headers_out.headers allocation error handling.
If initialization of a header failed for some reason after ngx_list_push(),
leaving the header as is can result in uninitialized memory access by
the header filter or the log module. The fix is to clear partially
initialized headers in case of errors.
For the Cache-Control header, the fix is to postpone pushing
r->headers_out.cache_control until its value is completed.
author | Sergey Kandaurov <pluknet@nginx.com> |
---|---|
date | Thu, 20 Apr 2017 18:26:37 +0300 |
parents | c85dfd99a2dd |
children | 573f20116163 |
comparison
equal
deleted
inserted
replaced
6985:23ecffd5bcfe | 6986:0cdee26605f3 |
---|---|
1078 location = path + clcf->root.len; | 1078 location = path + clcf->root.len; |
1079 | 1079 |
1080 } else { | 1080 } else { |
1081 location = ngx_pnalloc(r->pool, r->uri.len); | 1081 location = ngx_pnalloc(r->pool, r->uri.len); |
1082 if (location == NULL) { | 1082 if (location == NULL) { |
1083 ngx_http_clear_location(r); | |
1083 return NGX_ERROR; | 1084 return NGX_ERROR; |
1084 } | 1085 } |
1085 | 1086 |
1086 ngx_memcpy(location, r->uri.data, r->uri.len); | 1087 ngx_memcpy(location, r->uri.data, r->uri.len); |
1087 } | 1088 } |