mirror of
https://github.com/nginx/nginx.git
synced 2025-02-25 18:55:26 -06:00
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
a5895eb502
commit
4c031f9a6a
@ -318,6 +318,11 @@ ngx_http_rewrite(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
|
|||||||
|
|
||||||
value = cf->args->elts;
|
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));
|
ngx_memzero(&rc, sizeof(ngx_regex_compile_t));
|
||||||
|
|
||||||
rc.pattern = value[1];
|
rc.pattern = value[1];
|
||||||
|
Loading…
Reference in New Issue
Block a user