diff options
author | Ruslan Ermilov <ru@nginx.com> | 2012-12-17 19:03:33 +0000 |
---|---|---|
committer | Ruslan Ermilov <ru@nginx.com> | 2012-12-17 19:03:33 +0000 |
commit | c865f8dfa2826592b41b86e0048dd418c9eb86b8 (patch) | |
tree | ec42de5bb1d7035acfdccce5b309a3bd35d39b37 /src/http/ngx_http_variables.c | |
parent | b8a90c69039046ff6196b9e174e21c5377ed07dd (diff) | |
download | nginx-c865f8dfa2826592b41b86e0048dd418c9eb86b8.tar.gz nginx-c865f8dfa2826592b41b86e0048dd418c9eb86b8.zip |
Added checks that disallow adding a variable with an empty name.
Added variable name syntax checks to "geo" and "map" directives.
Diffstat (limited to 'src/http/ngx_http_variables.c')
-rw-r--r-- | src/http/ngx_http_variables.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/http/ngx_http_variables.c b/src/http/ngx_http_variables.c index db41964f5..d9f2e9894 100644 --- a/src/http/ngx_http_variables.c +++ b/src/http/ngx_http_variables.c @@ -330,6 +330,12 @@ ngx_http_add_variable(ngx_conf_t *cf, ngx_str_t *name, ngx_uint_t flags) ngx_http_variable_t *v; ngx_http_core_main_conf_t *cmcf; + if (name->len == 0) { + ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, + "invalid variable name \"$\""); + return NULL; + } + cmcf = ngx_http_conf_get_module_main_conf(cf, ngx_http_core_module); key = cmcf->variables_keys->keys.elts; @@ -393,6 +399,12 @@ ngx_http_get_variable_index(ngx_conf_t *cf, ngx_str_t *name) ngx_http_variable_t *v; ngx_http_core_main_conf_t *cmcf; + if (name->len == 0) { + ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, + "invalid variable name \"$\""); + return NGX_ERROR; + } + cmcf = ngx_http_conf_get_module_main_conf(cf, ngx_http_core_module); v = cmcf->variables.elts; |