]> git.kaiwu.me - nginx.git/commitdiff
Rewrite: fixed "return" directive without response text.
authorPiotr Sikora <piotr@aviatrix.com>
Mon, 26 Feb 2024 20:00:28 +0000 (20:00 +0000)
committerPiotr Sikora <piotr@aviatrix.com>
Mon, 26 Feb 2024 20:00:28 +0000 (20:00 +0000)
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@aviatrix.com>
src/http/modules/ngx_http_rewrite_module.c

index 0e6d4df64d09fea0dcaaff558a4e2e24ecffcf64..ff3b68716d485ebd3614850a4b36b2eec7f4a718 100644 (file)
@@ -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;
         }