# HG changeset patch # User Maxim Dounin # Date 1630264854 -10800 # Node ID 96e09beaa2cf43106dfffc1c4381669b87fed35d # Parent d869e43643ac2aae33d6ad637667e9891fd2f7bb Request body: added alert to catch duplicate body saving. If due to an error ngx_http_request_body_save_filter() is called more than once with rb->rest == 0, this used to result in a segmentation fault. Added an alert to catch such errors, just in case. diff --git a/src/http/ngx_http_request_body.c b/src/http/ngx_http_request_body.c --- a/src/http/ngx_http_request_body.c +++ b/src/http/ngx_http_request_body.c @@ -1246,6 +1246,12 @@ ngx_http_request_body_save_filter(ngx_ht if (rb->temp_file || r->request_body_in_file_only) { + if (rb->bufs && rb->bufs->buf->in_file) { + ngx_log_error(NGX_LOG_ALERT, r->connection->log, 0, + "body already in file"); + return NGX_HTTP_INTERNAL_SERVER_ERROR; + } + if (ngx_http_write_request_body(r) != NGX_OK) { return NGX_HTTP_INTERNAL_SERVER_ERROR; }