Browse Source

Check size against SIZE_T_CEILING in realloc too.

Fixes bug 2324.
Nick Mathewson 13 years ago
parent
commit
e09ab69703
2 changed files with 6 additions and 0 deletions
  1. 4 0
      changes/bug2324
  2. 2 0
      src/common/util.c

+ 4 - 0
changes/bug2324

@@ -0,0 +1,4 @@
+  o Minor bugfixes
+    - Add a check for SIZE_T_MAX to tor_realloc to try to avoid
+      underflow errors there too.  Fixes bug 2324.
+

+ 2 - 0
src/common/util.c

@@ -167,6 +167,8 @@ _tor_realloc(void *ptr, size_t size DMALLOC_PARAMS)
 {
   void *result;
 
+  tor_assert(size < SIZE_T_CEILING);
+
 #ifdef USE_DMALLOC
   result = dmalloc_realloc(file, line, ptr, size, DMALLOC_FUNC_REALLOC, 0);
 #else