mirror of
https://github.com/nginx/nginx.git
synced 2024-12-20 14:13:33 -06:00
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.
This commit is contained in:
parent
da130acfbe
commit
248bc41893
@ -209,6 +209,11 @@ ngx_http_dav_put_handler(ngx_http_request_t *r)
|
|||||||
ngx_ext_rename_file_t ext;
|
ngx_ext_rename_file_t ext;
|
||||||
ngx_http_dav_loc_conf_t *dlcf;
|
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);
|
ngx_http_map_uri_to_path(r, &path, &root, 0);
|
||||||
|
|
||||||
path.len--;
|
path.len--;
|
||||||
|
Loading…
Reference in New Issue
Block a user