]> git.kaiwu.me - nginx.git/commitdiff
Geo: fixed overflow when iterating over ranges.
authorRuslan Ermilov <ru@nginx.com>
Tue, 23 Aug 2016 12:57:29 +0000 (15:57 +0300)
committerRuslan Ermilov <ru@nginx.com>
Tue, 23 Aug 2016 12:57:29 +0000 (15:57 +0300)
src/http/modules/ngx_http_geo_module.c
src/stream/ngx_stream_geo_module.c

index 53e89692dae3cdbbc1ed9ab73cd51b01a6cbfb32..af061af81d58aeae5505239688b4492398552165 100644 (file)
@@ -946,7 +946,9 @@ ngx_http_geo_add_range(ngx_conf_t *cf, ngx_http_geo_conf_ctx_t *ctx,
 
     next:
 
-        continue;
+        if (h == 0xffff) {
+            break;
+        }
     }
 
     return NGX_CONF_OK;
@@ -985,7 +987,7 @@ ngx_http_geo_delete_range(ngx_conf_t *cf, ngx_http_geo_conf_ctx_t *ctx,
 
         if (a == NULL) {
             warn = 1;
-            continue;
+            goto next;
         }
 
         range = a->elts;
@@ -1010,6 +1012,12 @@ ngx_http_geo_delete_range(ngx_conf_t *cf, ngx_http_geo_conf_ctx_t *ctx,
 
             warn = 1;
         }
+
+    next:
+
+        if (h == 0xffff) {
+            break;
+        }
     }
 
     return warn;
index 32fb9c0f4f3b4d938fa74a9fb761ff35109d15e4..3bdeff723d61788d18825cf158cf8434121801c4 100644 (file)
@@ -896,7 +896,9 @@ ngx_stream_geo_add_range(ngx_conf_t *cf, ngx_stream_geo_conf_ctx_t *ctx,
 
     next:
 
-        continue;
+        if (h == 0xffff) {
+            break;
+        }
     }
 
     return NGX_CONF_OK;
@@ -935,7 +937,7 @@ ngx_stream_geo_delete_range(ngx_conf_t *cf, ngx_stream_geo_conf_ctx_t *ctx,
 
         if (a == NULL) {
             warn = 1;
-            continue;
+            goto next;
         }
 
         range = a->elts;
@@ -960,6 +962,12 @@ ngx_stream_geo_delete_range(ngx_conf_t *cf, ngx_stream_geo_conf_ctx_t *ctx,
 
             warn = 1;
         }
+
+    next:
+
+        if (h == 0xffff) {
+            break;
+        }
     }
 
     return warn;