summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorYichun Zhang <agentzh@gmail.com>2014-07-25 14:43:29 -0700
committerYichun Zhang <agentzh@gmail.com>2014-07-25 14:43:29 -0700
commit7b24c53efee348e919d03cba5c74445095402593 (patch)
tree25f46a0eff22adee73b56191bef6a8fd74f07407
parent3ba8f2f73d27af3cd56506922edd91db2a56eb03 (diff)
downloadnginx-7b24c53efee348e919d03cba5c74445095402593.tar.gz
nginx-7b24c53efee348e919d03cba5c74445095402593.tar.bz2
GeoIP: not all variable fields were initialized.
The ngx_http_geoip_city_float_variable and ngx_http_geoip_city_int_variable functions did not always initialize all variable fields like "not_found", which could lead to empty values for those corresponding nginx variables randomly.
-rw-r--r--src/http/modules/ngx_http_geoip_module.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/http/modules/ngx_http_geoip_module.c b/src/http/modules/ngx_http_geoip_module.c
index 1af166e62..8e151aa8f 100644
--- a/src/http/modules/ngx_http_geoip_module.c
+++ b/src/http/modules/ngx_http_geoip_module.c
@@ -553,6 +553,9 @@ ngx_http_geoip_city_float_variable(ngx_http_request_t *r,
val = *(float *) ((char *) gr + data);
v->len = ngx_sprintf(v->data, "%.4f", val) - v->data;
+ v->valid = 1;
+ v->no_cacheable = 0;
+ v->not_found = 0;
GeoIPRecord_delete(gr);
@@ -582,6 +585,9 @@ ngx_http_geoip_city_int_variable(ngx_http_request_t *r,
val = *(int *) ((char *) gr + data);
v->len = ngx_sprintf(v->data, "%d", val) - v->data;
+ v->valid = 1;
+ v->no_cacheable = 0;
+ v->not_found = 0;
GeoIPRecord_delete(gr);