Skip to content

Commit fd9d43b

Browse files
committed
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.
1 parent aa02695 commit fd9d43b

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

src/http/ngx_http_request_body.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1246,6 +1246,12 @@ ngx_http_request_body_save_filter(ngx_http_request_t *r, ngx_chain_t *in)
12461246

12471247
if (rb->temp_file || r->request_body_in_file_only) {
12481248

1249+
if (rb->bufs && rb->bufs->buf->in_file) {
1250+
ngx_log_error(NGX_LOG_ALERT, r->connection->log, 0,
1251+
"body already in file");
1252+
return NGX_HTTP_INTERNAL_SERVER_ERROR;
1253+
}
1254+
12491255
if (ngx_http_write_request_body(r) != NGX_OK) {
12501256
return NGX_HTTP_INTERNAL_SERVER_ERROR;
12511257
}

0 commit comments

Comments
 (0)