[PATCH] Rewrite: fix "return" directive without response text
Sergey Kandaurov
pluknet at nginx.com
Wed Mar 27 17:51:02 UTC 2024
> On 28 Feb 2024, at 05:21, Piotr Sikora via nginx-devel <nginx-devel at nginx.org> wrote:
>
> # HG changeset patch
> # User Piotr Sikora <piotr at 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 <piotr at 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;
> }
>
Pushed, thanks.
--
Sergey Kandaurov
More information about the nginx-devel
mailing list