From 2f9e8431e696b27ffcd69e455a1ee006ca14f8e3 Mon Sep 17 00:00:00 2001 From: Piotr Sikora Date: Mon, 26 Feb 2024 20:00:28 +0000 Subject: [PATCH] Rewrite: fixed "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 --- src/http/modules/ngx_http_rewrite_module.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/http/modules/ngx_http_rewrite_module.c b/src/http/modules/ngx_http_rewrite_module.c index 0e6d4df64..ff3b68716 100644 --- a/src/http/modules/ngx_http_rewrite_module.c +++ b/src/http/modules/ngx_http_rewrite_module.c @@ -489,6 +489,7 @@ ngx_http_rewrite_return(ngx_conf_t *cf, ngx_command_t *cmd, void *conf) } if (cf->args->nelts == 2) { + ngx_str_set(&ret->text.value, ""); return NGX_CONF_OK; }