aboutsummaryrefslogtreecommitdiff
path: root/src/common/mempool.c
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2010-12-15 22:47:28 -0500
committerNick Mathewson <nickm@torproject.org>2010-12-15 22:48:23 -0500
commitb5e293afe6b3c98b50c23cc443969b5f840dca32 (patch)
tree803a93a09d717782452108ab21ab2cac6a732f26 /src/common/mempool.c
parentddfb398494ddf9d514a3ff16ade69c619c659ce7 (diff)
parentb0def605a52b3acce1cb212f270b184d72f237f5 (diff)
downloadtor-b5e293afe6b3c98b50c23cc443969b5f840dca32.tar
tor-b5e293afe6b3c98b50c23cc443969b5f840dca32.tar.gz
Merge remote branch fix_security_bug_021 into fix_security_bug_022
Conflicts: src/common/memarea.c src/or/or.h src/or/rendclient.c
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));