changeset 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 3eb1a92a2f05
children 1301a58b5dac
files src/http/modules/ngx_http_geo_module.c src/stream/ngx_stream_geo_module.c
diffstat 2 files changed, 20 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/src/http/modules/ngx_http_geo_module.c	Mon Aug 22 18:53:21 2016 +0300
+++ b/src/http/modules/ngx_http_geo_module.c	Tue Aug 23 15:57:29 2016 +0300
@@ -946,7 +946,9 @@
 
     next:
 
-        continue;
+        if (h == 0xffff) {
+            break;
+        }
     }
 
     return NGX_CONF_OK;
@@ -985,7 +987,7 @@
 
         if (a == NULL) {
             warn = 1;
-            continue;
+            goto next;
         }
 
         range = a->elts;
@@ -1010,6 +1012,12 @@
 
             warn = 1;
         }
+
+    next:
+
+        if (h == 0xffff) {
+            break;
+        }
     }
 
     return warn;
--- a/src/stream/ngx_stream_geo_module.c	Mon Aug 22 18:53:21 2016 +0300
+++ b/src/stream/ngx_stream_geo_module.c	Tue Aug 23 15:57:29 2016 +0300
@@ -896,7 +896,9 @@
 
     next:
 
-        continue;
+        if (h == 0xffff) {
+            break;
+        }
     }
 
     return NGX_CONF_OK;
@@ -935,7 +937,7 @@
 
         if (a == NULL) {
             warn = 1;
-            continue;
+            goto next;
         }
 
         range = a->elts;
@@ -960,6 +962,12 @@
 
             warn = 1;
         }
+
+    next:
+
+        if (h == 0xffff) {
+            break;
+        }
     }
 
     return warn;