# HG changeset patch # User Ruslan Ermilov # Date 1471957049 -10800 # Node ID ec141a44641b2014016a377132c8272f52f2ee2e # Parent 3eb1a92a2f050734a9cfefd5fda1676462fb0048 Geo: fixed overflow when iterating over ranges. diff --git a/src/http/modules/ngx_http_geo_module.c b/src/http/modules/ngx_http_geo_module.c --- a/src/http/modules/ngx_http_geo_module.c +++ b/src/http/modules/ngx_http_geo_module.c @@ -946,7 +946,9 @@ ngx_http_geo_add_range(ngx_conf_t *cf, n next: - continue; + if (h == 0xffff) { + break; + } } return NGX_CONF_OK; @@ -985,7 +987,7 @@ ngx_http_geo_delete_range(ngx_conf_t *cf if (a == NULL) { warn = 1; - continue; + goto next; } range = a->elts; @@ -1010,6 +1012,12 @@ ngx_http_geo_delete_range(ngx_conf_t *cf warn = 1; } + + next: + + if (h == 0xffff) { + break; + } } return warn; diff --git a/src/stream/ngx_stream_geo_module.c b/src/stream/ngx_stream_geo_module.c --- a/src/stream/ngx_stream_geo_module.c +++ b/src/stream/ngx_stream_geo_module.c @@ -896,7 +896,9 @@ ngx_stream_geo_add_range(ngx_conf_t *cf, next: - continue; + if (h == 0xffff) { + break; + } } return NGX_CONF_OK; @@ -935,7 +937,7 @@ ngx_stream_geo_delete_range(ngx_conf_t * if (a == NULL) { warn = 1; - continue; + goto next; } range = a->elts; @@ -960,6 +962,12 @@ ngx_stream_geo_delete_range(ngx_conf_t * warn = 1; } + + next: + + if (h == 0xffff) { + break; + } } return warn;