aboutsummaryrefslogtreecommitdiff
path: root/src/common/mempool.c
diff options
context:
space:
mode:
authorRoger Dingledine <arma@torproject.org>2010-12-16 17:24:11 -0500
committerRoger Dingledine <arma@torproject.org>2010-12-16 17:24:11 -0500
commitc63c937465f91b60f07e70942e2cb5af1b90dce4 (patch)
tree1b44da39cbe47b5176829100ed8ff038348681fc /src/common/mempool.c
parent591f65dde68c7847e4282c4cba5a11868fe13158 (diff)
parentb5e293afe6b3c98b50c23cc443969b5f840dca32 (diff)
downloadtor-c63c937465f91b60f07e70942e2cb5af1b90dce4.tar
tor-c63c937465f91b60f07e70942e2cb5af1b90dce4.tar.gz
Merge commit 'nickm/fix_security_bug_022' into maint-0.2.2
Diffstat (limited to 'src/common/mempool.c')
-rw-r--r--src/common/mempool.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/common/mempool.c b/src/common/mempool.c
index c795d83f0..9d019d618 100644
--- a/src/common/mempool.c
+++ b/src/common/mempool.c
@@ -357,6 +357,10 @@ mp_pool_new(size_t item_size, size_t chunk_capacity)
mp_pool_t *pool;
size_t alloc_size, new_chunk_cap;
+ tor_assert(item_size < SIZE_T_CEILING);
+ tor_assert(chunk_capacity < SIZE_T_CEILING);
+ tor_assert(SIZE_T_CEILING / item_size > chunk_capacity);
+
pool = ALLOC(sizeof(mp_pool_t));
CHECK_ALLOC(pool);
memset(pool, 0, sizeof(mp_pool_t));