tor_assert(base32_encoded_size(srclen) <= destlen);
tor_assert(destlen < SIZE_T_CEILING);
+ /* Make sure we leave no uninitialized data in the destination buffer. */
+ memset(dest, 0, destlen);
+
for (i=0,bit=0; bit < nbits; ++i, bit+=5) {
/* set v to the 16-bit value starting at src[bits/8], 0-padded. */
v = ((uint8_t)src[bit/8]) << 8;
tor_assert((nbits/8) <= destlen); /* We need enough space. */
tor_assert(destlen < SIZE_T_CEILING);
+ /* Make sure we leave no uninitialized data in the destination buffer. */
memset(dest, 0, destlen);
/* Convert base32 encoded chars to the 5-bit values that they represent. */
if (enclen > INT_MAX)
return -1;
- memset(dest, 0, enclen);
+ /* Make sure we leave no uninitialized data in the destination buffer. */
+ memset(dest, 0, destlen);
/* XXX/Yawning: If this ends up being too slow, this can be sped up
* by separating the multiline format case and the normal case, and
if (destlen > SIZE_T_CEILING)
return -1;
+ /* Make sure we leave no uninitialized data in the destination buffer. */
memset(dest, 0, destlen);
/* Iterate over all the bytes in src. Each one will add 0 or 6 bits to the
tor_assert(destlen >= srclen*2+1);
tor_assert(destlen < SIZE_T_CEILING);
+ /* Make sure we leave no uninitialized data in the destination buffer. */
+ memset(dest, 0, destlen);
+
cp = dest;
end = src+srclen;
while (src<end) {
if (destlen < srclen/2 || destlen > INT_MAX)
return -1;
+ /* Make sure we leave no uninitialized data in the destination buffer. */
memset(dest, 0, destlen);
end = src+srclen;