Welcome! Log In Create A New Profile

Advanced

[nginx] Request body: added alert to catch duplicate body saving.

Maxim Dounin
August 29, 2021 05:06PM
details: https://hg.nginx.org/nginx/rev/96e09beaa2cf
branches:
changeset: 7912:96e09beaa2cf
user: Maxim Dounin <mdounin@mdounin.ru>
date: Sun Aug 29 22:20:54 2021 +0300
description:
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.

diffstat:

src/http/ngx_http_request_body.c | 6 ++++++
1 files changed, 6 insertions(+), 0 deletions(-)

diffs (16 lines):

diff -r d869e43643ac -r 96e09beaa2cf src/http/ngx_http_request_body.c
--- a/src/http/ngx_http_request_body.c Sun Aug 29 22:20:49 2021 +0300
+++ b/src/http/ngx_http_request_body.c Sun Aug 29 22:20:54 2021 +0300
@@ -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;
}
_______________________________________________
nginx-devel mailing list
nginx-devel@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx-devel
Subject Author Views Posted

[nginx] Request body: added alert to catch duplicate body saving.

Maxim Dounin 231 August 29, 2021 05:06PM



Sorry, you do not have permission to post/reply in this forum.

Online Users

Guests: 165
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 500 on July 15, 2024
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready