From: Timo Sirainen Date: Wed, 20 May 2020 10:42:22 +0000 (+0300) Subject: lib: hash - Add assert to make sure hash table doesn't grow beyond UINT_MAX nodes X-Git-Tag: 2.3.14.rc1~104 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=d4ceac0f2a22e61a77d6b508991a42fc789c22c4;p=thirdparty%2Fdovecot%2Fcore.git lib: hash - Add assert to make sure hash table doesn't grow beyond UINT_MAX nodes hash_table_count() returns unsigned int, so the node count can't be larger. It's internally also tracked as unsigned int currently. It should be large enough for all practical use cases. --- diff --git a/src/lib/hash.c b/src/lib/hash.c index 76d51baaaa..16f3c96723 100644 --- a/src/lib/hash.c +++ b/src/lib/hash.c @@ -219,6 +219,7 @@ hash_table_insert_node(struct hash_table *table, void *key, void *value, unsigned int hash; bool check_existing = TRUE; + i_assert(table->nodes_count < UINT_MAX); i_assert(key != NULL); if(opcode == HASH_TABLE_OP_RESIZE)