Welcome! Log In Create A New Profile

Advanced

[nginx] Rewrite: disallow empty replacements.

December 23, 2019 10:48AM
details: https://hg.nginx.org/nginx/rev/db8df9cd84c8
branches:
changeset: 7606:db8df9cd84c8
user: Ruslan Ermilov <ru@nginx.com>
date: Mon Dec 16 15:19:01 2019 +0300
description:
Rewrite: disallow empty replacements.

While empty replacements were caught at run-time, parsing code
of the "rewrite" directive expects that a minimum length of the
"replacement" argument is 1.

diffstat:

src/http/modules/ngx_http_rewrite_module.c | 5 +++++
1 files changed, 5 insertions(+), 0 deletions(-)

diffs (15 lines):

diff -r 02a539522be4 -r db8df9cd84c8 src/http/modules/ngx_http_rewrite_module.c
--- a/src/http/modules/ngx_http_rewrite_module.c Mon Dec 16 15:19:01 2019 +0300
+++ b/src/http/modules/ngx_http_rewrite_module.c Mon Dec 16 15:19:01 2019 +0300
@@ -318,6 +318,11 @@

value = cf->args->elts;

+ if (value[2].len == 0) {
+ ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, "empty replacement");
+ return NGX_CONF_ERROR;
+ }
+
ngx_memzero(&rc, sizeof(ngx_regex_compile_t));

rc.pattern = value[1];
_______________________________________________
nginx-devel mailing list
nginx-devel@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx-devel
Subject Author Views Posted

[nginx] Rewrite: disallow empty replacements.

ru@nginx.com 89 December 23, 2019 10:48AM



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

Online Users

Guests: 70
Record Number of Users: 6 on February 13, 2018
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready