Mercurial > hg > nginx
changeset 4918:e7467ae41626
Dav: fixed segfault on PUT if body was already read (ticket #238).
If request body reading happens with different options it's possible
that there will be no r->request_body->temp_file available (or even
no r->request_body available if body was discarded). Return internal
server error in this case instead of committing suicide by dereferencing
a null pointer.
author | Maxim Dounin <mdounin@mdounin.ru> |
---|---|
date | Wed, 21 Nov 2012 00:51:37 +0000 |
parents | 484aec758d2c |
children | bd6299189b49 |
files | src/http/modules/ngx_http_dav_module.c |
diffstat | 1 files changed, 5 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/src/http/modules/ngx_http_dav_module.c Tue Nov 20 13:37:55 2012 +0000 +++ b/src/http/modules/ngx_http_dav_module.c Wed Nov 21 00:51:37 2012 +0000 @@ -209,6 +209,11 @@ ngx_ext_rename_file_t ext; ngx_http_dav_loc_conf_t *dlcf; + if (r->request_body == NULL || r->request_body->temp_file == NULL) { + ngx_http_finalize_request(r, NGX_HTTP_INTERNAL_SERVER_ERROR); + return; + } + ngx_http_map_uri_to_path(r, &path, &root, 0); path.len--;