diff options
author | Valentin Bartenev <vbart@nginx.com> | 2012-09-03 12:55:50 +0000 |
---|---|---|
committer | Valentin Bartenev <vbart@nginx.com> | 2012-09-03 12:55:50 +0000 |
commit | 605a0ab2e1bbaba36e3d275e22b066238f87b4cb (patch) | |
tree | 3cf885ec8cbe4425d9e4875e64abc474a631c900 /src | |
parent | 7ee8de668c4a3d337eb3997a258e4e40adaf069c (diff) | |
download | nginx-605a0ab2e1bbaba36e3d275e22b066238f87b4cb.tar.gz nginx-605a0ab2e1bbaba36e3d275e22b066238f87b4cb.zip |
Limit req: fix of rbtree node insertion on hash collisions.
The rbtree used in ngx_http_limit_req_module has two level of keys, the top is
hash, and the next is the value string itself. However, when inserting a new
node, only hash has been set, while the value string has been left empty.
The bug was introduced in r4419 (1.1.14).
Found by Charles Chen.
Diffstat (limited to 'src')
-rw-r--r-- | src/http/modules/ngx_http_limit_req_module.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/http/modules/ngx_http_limit_req_module.c b/src/http/modules/ngx_http_limit_req_module.c index 3f9910e71..31a8b987a 100644 --- a/src/http/modules/ngx_http_limit_req_module.c +++ b/src/http/modules/ngx_http_limit_req_module.c @@ -444,17 +444,17 @@ ngx_http_limit_req_lookup(ngx_http_limit_req_limit_t *limit, ngx_uint_t hash, node->key = hash; - ngx_rbtree_insert(&ctx->sh->rbtree, node); - lr = (ngx_http_limit_req_node_t *) &node->color; - ngx_queue_insert_head(&ctx->sh->queue, &lr->queue); - lr->len = (u_char) len; lr->excess = 0; ngx_memcpy(lr->data, data, len); + ngx_rbtree_insert(&ctx->sh->rbtree, node); + + ngx_queue_insert_head(&ctx->sh->queue, &lr->queue); + if (account) { lr->last = now; lr->count = 0; |