]> git.ipfire.org Git - thirdparty/tor.git/commitdiff
Refine the memwipe() arguments check for 18089 a little more.
authorNick Mathewson <nickm@torproject.org>
Tue, 19 Jan 2016 13:28:58 +0000 (08:28 -0500)
committerNick Mathewson <nickm@torproject.org>
Tue, 19 Jan 2016 13:28:58 +0000 (08:28 -0500)
We still silently ignore
     memwipe(NULL, ch, 0);
and
     memwipe(ptr, ch, 0);  /* for ptr != NULL */

But we now assert on:
     memwipe(NULL, ch, 30);

src/common/crypto.c

index 4e0b38372dcc4cd00256d5283c82025187950a63..8402ca079a514a779f58a4ddb1d4f7533ec644be 100644 (file)
@@ -3030,9 +3030,11 @@ base32_decode(char *dest, size_t destlen, const char *src, size_t srclen)
 void
 memwipe(void *mem, uint8_t byte, size_t sz)
 {
-  if (mem == NULL || sz == 0) {
+  if (sz == 0) {
     return;
   }
+  /* If sz is nonzero, then mem must not be NULL. */
+  tor_assert(mem != NULL);
 
   /* Data this large is likely to be an underflow. */
   tor_assert(sz < SIZE_T_CEILING);