[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[tor-commits] [tor/master] Refactor the tor_reallocarray_ overflow check.



commit 3206dbdce1d055e30d84f9f5dd433c733fee3d8a
Author: Mansour Moufid <mansourmoufid@xxxxxxxxx>
Date:   Sun Oct 19 12:11:53 2014 -0400

    Refactor the tor_reallocarray_ overflow check.
---
 src/common/util.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/common/util.c b/src/common/util.c
index 929eb5f..6e30c47 100644
--- a/src/common/util.c
+++ b/src/common/util.c
@@ -262,7 +262,7 @@ tor_reallocarray_(void *ptr, size_t sz1, size_t sz2 DMALLOC_PARAMS)
 {
   /* XXXX we can make this return 0, but we would need to check all the
    * reallocarray users. */
-  tor_assert(sz2 == 0 || sz1 < SIZE_T_CEILING / sz2);
+  tor_assert(size_mul_check(sz1, sz2));
 
   return tor_realloc(ptr, (sz1 * sz2) DMALLOC_FN_ARGS);
 }



_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits