[nginx] Rewrite: disallow empty replacements.
Ruslan Ermilov
ru at nginx.com
Mon Dec 23 15:45:52 UTC 2019
details: https://hg.nginx.org/nginx/rev/db8df9cd84c8
branches:
changeset: 7606:db8df9cd84c8
user: Ruslan Ermilov <ru at 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];
More information about the nginx-devel
mailing list