# HG changeset patch
# User Piotr Sikora <pi...@aviatrix.com>
# Date 1708977628 0
#      Mon Feb 26 20:00:28 2024 +0000
# Branch patch008
# Node ID 3cde11b747c08c69889edc014a700317fe4d1d88
# Parent  5584232259d28489efba149f2f5ae730691ff0d4
Rewrite: fix "return" directive without response text.

Previously, the response text wasn't initialized and the rewrite module
was sending response body set to NULL.

Found with UndefinedBehaviorSanitizer (pointer-overflow).

Signed-off-by: Piotr Sikora <pi...@aviatrix.com>

diff -r 5584232259d2 -r 3cde11b747c0 src/http/modules/ngx_http_rewrite_module.c
--- a/src/http/modules/ngx_http_rewrite_module.c        Mon Feb 26 20:00:26 
2024 +0000
+++ b/src/http/modules/ngx_http_rewrite_module.c        Mon Feb 26 20:00:28 
2024 +0000
@@ -489,6 +489,7 @@
         }
 
         if (cf->args->nelts == 2) {
+            ngx_str_set(&ret->text.value, "");
             return NGX_CONF_OK;
         }
 
_______________________________________________
nginx-devel mailing list
nginx-devel@nginx.org
https://mailman.nginx.org/mailman/listinfo/nginx-devel

Reply via email to