summaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorMaxim Dounin <mdounin@mdounin.ru>2012-12-10 17:51:10 +0000
committerMaxim Dounin <mdounin@mdounin.ru>2012-12-10 17:51:10 +0000
commitc460629181248f47c6a77edacd9d17b7c1f26f12 (patch)
tree549d94eeb5441fce9d87a7e482992619a54c5af5 /src
parente3cf44789f2a6e256a596f187c6d4211859f1d73 (diff)
downloadnginx-c460629181248f47c6a77edacd9d17b7c1f26f12.tar.gz
nginx-c460629181248f47c6a77edacd9d17b7c1f26f12.tar.bz2
Merge of r4919: fixed segfault on PUT in dav module.
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.
Diffstat (limited to 'src')
-rw-r--r--src/http/modules/ngx_http_dav_module.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/http/modules/ngx_http_dav_module.c b/src/http/modules/ngx_http_dav_module.c
index dbb17ac30..a97c60e44 100644
--- a/src/http/modules/ngx_http_dav_module.c
+++ b/src/http/modules/ngx_http_dav_module.c
@@ -209,6 +209,11 @@ ngx_http_dav_put_handler(ngx_http_request_t *r)
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--;