summaryrefslogtreecommitdiff
path: root/src/common/crypto.c
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2014-12-22 16:02:47 -0500
committerNick Mathewson <nickm@torproject.org>2014-12-22 16:02:47 -0500
commit0965bbd5ac3a3dc4016a0c13082506ac2039905e (patch)
tree14a6c733beb970ec93200dd960ff8375074c2d5e /src/common/crypto.c
parent03d2df62f614f97d2b5cf52518565ce91333ba87 (diff)
parent6d728ba8801031b27937436cbcad033f4406a8b5 (diff)
downloadtor-0965bbd5ac3a3dc4016a0c13082506ac2039905e.tar.gz
tor-0965bbd5ac3a3dc4016a0c13082506ac2039905e.zip
Merge remote-tracking branch 'origin/maint-0.2.5'
Diffstat (limited to 'src/common/crypto.c')
-rw-r--r--src/common/crypto.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/common/crypto.c b/src/common/crypto.c
index 713e588412..f4946aa8f9 100644
--- a/src/common/crypto.c
+++ b/src/common/crypto.c
@@ -2752,6 +2752,8 @@ base64_decode(char *dest, size_t destlen, const char *src, size_t srclen)
if (destlen > SIZE_T_CEILING)
return -1;
+ memset(dest, 0, destlen);
+
EVP_DecodeInit(&ctx);
EVP_DecodeUpdate(&ctx, (unsigned char*)dest, &len,
(unsigned char*)src, srclen);
@@ -2773,6 +2775,8 @@ base64_decode(char *dest, size_t destlen, const char *src, size_t srclen)
if (destlen > SIZE_T_CEILING)
return -1;
+ memset(dest, 0, destlen);
+
/* Iterate over all the bytes in src. Each one will add 0 or 6 bits to the
* value we're decoding. Accumulate bits in <b>n</b>, and whenever we have
* 24 bits, batch them into 3 bytes and flush those bytes to dest.
@@ -2952,6 +2956,8 @@ base32_decode(char *dest, size_t destlen, const char *src, size_t srclen)
tor_assert((nbits/8) <= destlen); /* We need enough space. */
tor_assert(destlen < SIZE_T_CEILING);
+ memset(dest, 0, destlen);
+
/* Convert base32 encoded chars to the 5-bit values that they represent. */
tmp = tor_malloc_zero(srclen);
for (j = 0; j < srclen; ++j) {