From: W.C.A. Wijngaards Date: Wed, 27 Mar 2024 10:49:20 +0000 (+0100) Subject: - Fix for #1032, add safeguard to make table space positive. X-Git-Tag: release-1.20.0rc1~50 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=3ea078baf6e856258213dce22b5de53d0f22a6b4;p=thirdparty%2Funbound.git - Fix for #1032, add safeguard to make table space positive. --- diff --git a/doc/Changelog b/doc/Changelog index e8f1f1c39..1b73bf547 100644 --- a/doc/Changelog +++ b/doc/Changelog @@ -2,6 +2,7 @@ - Fix name of unit test for subnet cache response. - Fix #1032: The size of subnet_msg_cache calculation mistake cause memory usage increased beyond expectations. + - Fix for #1032, add safeguard to make table space positive. 25 March 2024: Yorgos - Merge #831 from Pierre4012: Improve Windows NSIS installer diff --git a/util/storage/lruhash.c b/util/storage/lruhash.c index 85bb8f02e..f14e83b56 100644 --- a/util/storage/lruhash.c +++ b/util/storage/lruhash.c @@ -543,7 +543,9 @@ lruhash_update_space_used(struct lruhash* table, void* cb_arg, int diff_size) /* find bin */ lock_quick_lock(&table->lock); - table->space_used = (size_t)((int)table->space_used + diff_size); + if((int)table->space_used + diff_size < 0) + table->space_used = 0; + else table->space_used = (size_t)((int)table->space_used + diff_size); if(table->space_used > table->space_max) reclaim_space(table, &reclaimlist);