From c865f8dfa2826592b41b86e0048dd418c9eb86b8 Mon Sep 17 00:00:00 2001 From: Ruslan Ermilov Date: Mon, 17 Dec 2012 19:03:33 +0000 Subject: Added checks that disallow adding a variable with an empty name. Added variable name syntax checks to "geo" and "map" directives. --- src/http/modules/ngx_http_geo_module.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'src/http/modules/ngx_http_geo_module.c') diff --git a/src/http/modules/ngx_http_geo_module.c b/src/http/modules/ngx_http_geo_module.c index 0e0aa0edc..1170cb337 100644 --- a/src/http/modules/ngx_http_geo_module.c +++ b/src/http/modules/ngx_http_geo_module.c @@ -325,7 +325,7 @@ ngx_http_geo_block(ngx_conf_t *cf, ngx_command_t *cmd, void *conf) name = value[1]; - if (name.len < 2 || name.data[0] != '$') { + if (name.data[0] != '$') { ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, "invalid variable name \"%V\"", &name); return NGX_CONF_ERROR; @@ -342,6 +342,13 @@ ngx_http_geo_block(ngx_conf_t *cf, ngx_command_t *cmd, void *conf) } name = value[2]; + + if (name.data[0] != '$') { + ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, + "invalid variable name \"%V\"", &name); + return NGX_CONF_ERROR; + } + name.len--; name.data++; -- cgit v1.2.3