diff src/stream/ngx_stream_geo_module.c @ 6661:ec141a44641b

Geo: fixed overflow when iterating over ranges.
author Ruslan Ermilov <ru@nginx.com>
date Tue, 23 Aug 2016 15:57:29 +0300
parents 873d7053efb9
children 1301a58b5dac
line wrap: on
line diff
--- 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;