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.
This commit is contained in:
parent
b44253a3bc
commit
b26e64492b
1 changed files with 5 additions and 0 deletions
|
@ -318,6 +318,11 @@ ngx_http_rewrite(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
|
|||
|
||||
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];
|
||||
|
|
Loading…
Reference in a new issue