]> git.ipfire.org Git - thirdparty/tor.git/commitdiff
Refactor the tor_reallocarray_ overflow check.
authorMansour Moufid <mansourmoufid@gmail.com>
Sun, 19 Oct 2014 16:11:53 +0000 (12:11 -0400)
committerNick Mathewson <nickm@torproject.org>
Sun, 2 Nov 2014 16:54:42 +0000 (11:54 -0500)
src/common/util.c

index 929eb5ffb2fdaa1be87365acaffe5bd6260753b8..6e30c47bf9e99a7155170ed0990916d30bbb799b 100644 (file)
@@ -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);
 }