changeset 5773:494c2c2a0247

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.
author Yichun Zhang <agentzh@gmail.com>
date Fri, 25 Jul 2014 14:43:29 -0700
parents d421be0d842a
children 9bf58a3da25b
files src/http/modules/ngx_http_geoip_module.c
diffstat 1 files changed, 6 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- 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_h
     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_htt
     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);