comparison src/http/modules/ngx_http_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
comparison
equal deleted inserted replaced
6660:3eb1a92a2f05 6661:ec141a44641b
944 range->end = (u_short) e; 944 range->end = (u_short) e;
945 range->value = ctx->value; 945 range->value = ctx->value;
946 946
947 next: 947 next:
948 948
949 continue; 949 if (h == 0xffff) {
950 break;
951 }
950 } 952 }
951 953
952 return NGX_CONF_OK; 954 return NGX_CONF_OK;
953 } 955 }
954 956
983 985
984 a = (ngx_array_t *) ctx->high.low[h]; 986 a = (ngx_array_t *) ctx->high.low[h];
985 987
986 if (a == NULL) { 988 if (a == NULL) {
987 warn = 1; 989 warn = 1;
988 continue; 990 goto next;
989 } 991 }
990 992
991 range = a->elts; 993 range = a->elts;
992 for (i = 0; i < a->nelts; i++) { 994 for (i = 0; i < a->nelts; i++) {
993 995
1007 { 1009 {
1008 continue; 1010 continue;
1009 } 1011 }
1010 1012
1011 warn = 1; 1013 warn = 1;
1014 }
1015
1016 next:
1017
1018 if (h == 0xffff) {
1019 break;
1012 } 1020 }
1013 } 1021 }
1014 1022
1015 return warn; 1023 return warn;
1016 } 1024 }