diff options
| author | Maxim Dounin <mdounin@mdounin.ru> | 2012-09-24 19:11:45 +0000 |
|---|---|---|
| committer | Maxim Dounin <mdounin@mdounin.ru> | 2012-09-24 19:11:45 +0000 |
| commit | 9e5528f244ad0befd167bee1522def97ebfc6256 (patch) | |
| tree | 76c1cccc3357a8e91fe964b6d9198112bf8b8df5 /src | |
| parent | 21ccde77f5b632fc1d780d4533a7efa5be69fe9d (diff) | |
| download | nginx-9e5528f244ad0befd167bee1522def97ebfc6256.tar.gz nginx-9e5528f244ad0befd167bee1522def97ebfc6256.tar.bz2 | |
Merge of r4833: limit req: fix of rbtree node insertion.
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; |
