Mercurial > hg > nginx
comparison src/http/ngx_http_request_body.c @ 7912:96e09beaa2cf
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.
author | Maxim Dounin <mdounin@mdounin.ru> |
---|---|
date | Sun, 29 Aug 2021 22:20:54 +0300 |
parents | d869e43643ac |
children | 185c86b830ef |
comparison
equal
deleted
inserted
replaced
7911:d869e43643ac | 7912:96e09beaa2cf |
---|---|
1244 | 1244 |
1245 /* rb->rest == 0 */ | 1245 /* rb->rest == 0 */ |
1246 | 1246 |
1247 if (rb->temp_file || r->request_body_in_file_only) { | 1247 if (rb->temp_file || r->request_body_in_file_only) { |
1248 | 1248 |
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 | |
1249 if (ngx_http_write_request_body(r) != NGX_OK) { | 1255 if (ngx_http_write_request_body(r) != NGX_OK) { |
1250 return NGX_HTTP_INTERNAL_SERVER_ERROR; | 1256 return NGX_HTTP_INTERNAL_SERVER_ERROR; |
1251 } | 1257 } |
1252 | 1258 |
1253 if (rb->temp_file->file.offset != 0) { | 1259 if (rb->temp_file->file.offset != 0) { |