aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2016-01-19 08:28:58 -0500
committerNick Mathewson <nickm@torproject.org>2016-01-19 08:28:58 -0500
commite2efa9e321972709933b6b9a68da035e1a91aa08 (patch)
tree5ca380774847927eff64d297657f1352306412eb
parentdb8156533133836b19bca51f7fabba4d161b6ba2 (diff)
downloadtor-e2efa9e321972709933b6b9a68da035e1a91aa08.tar.gz
tor-e2efa9e321972709933b6b9a68da035e1a91aa08.zip
Refine the memwipe() arguments check for 18089 a little more.
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);
-rw-r--r--src/common/crypto.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/common/crypto.c b/src/common/crypto.c
index 4e0b38372d..8402ca079a 100644
--- a/src/common/crypto.c
+++ b/src/common/crypto.c
@@ -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);