]> git.kaiwu.me - nginx.git/commitdiff
fix segfault when geo range replaces starting part of another range
authorIgor Sysoev <igor@sysoev.ru>
Mon, 19 Jan 2009 16:42:14 +0000 (16:42 +0000)
committerIgor Sysoev <igor@sysoev.ru>
Mon, 19 Jan 2009 16:42:14 +0000 (16:42 +0000)
src/http/modules/ngx_http_geo_module.c

index 5535eb29907893e8f095dc4c7e9c0b7079629d8c..bd6499ec7d3cd09bb916178fb1cdc78706572bbb 100644 (file)
@@ -636,8 +636,8 @@ ngx_http_geo_add_range(ngx_conf_t *cf, ngx_http_geo_conf_ctx_t *ctx,
 
                 range = a->elts;
 
-                ngx_memcpy(&range[i + 2], &range[i + 1],
-                           (a->nelts - 2 - i) * sizeof(ngx_http_geo_range_t));
+                ngx_memcpy(&range[i + 1], &range[i],
+                           (a->nelts - 1 - i) * sizeof(ngx_http_geo_range_t));
 
                 range[i + 1].start = (u_short) (e + 1);