comparison src/http/modules/ngx_http_geoip_module.c @ 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 f3df4e420ae7
children 2a288909abc6
comparison
equal deleted inserted replaced
5772:d421be0d842a 5773:494c2c2a0247
551 } 551 }
552 552
553 val = *(float *) ((char *) gr + data); 553 val = *(float *) ((char *) gr + data);
554 554
555 v->len = ngx_sprintf(v->data, "%.4f", val) - v->data; 555 v->len = ngx_sprintf(v->data, "%.4f", val) - v->data;
556 v->valid = 1;
557 v->no_cacheable = 0;
558 v->not_found = 0;
556 559
557 GeoIPRecord_delete(gr); 560 GeoIPRecord_delete(gr);
558 561
559 return NGX_OK; 562 return NGX_OK;
560 } 563 }
580 } 583 }
581 584
582 val = *(int *) ((char *) gr + data); 585 val = *(int *) ((char *) gr + data);
583 586
584 v->len = ngx_sprintf(v->data, "%d", val) - v->data; 587 v->len = ngx_sprintf(v->data, "%d", val) - v->data;
588 v->valid = 1;
589 v->no_cacheable = 0;
590 v->not_found = 0;
585 591
586 GeoIPRecord_delete(gr); 592 GeoIPRecord_delete(gr);
587 593
588 return NGX_OK; 594 return NGX_OK;
589 } 595 }