summaryrefslogtreecommitdiff
path: root/src/lib/encoding/binascii.c
diff options
context:
space:
mode:
authorteor <teor@torproject.org>2019-04-05 15:10:36 +1000
committerteor <teor@torproject.org>2019-04-05 15:17:19 +1000
commitc616f457762117cbcbb982a0224d9f8eb2cd9419 (patch)
tree389304be55ba7a3665db9c4a3b0f50fac4fc20ad /src/lib/encoding/binascii.c
parent5e2cba8eb4b80990fa63626054d070ad77578028 (diff)
downloadtor-c616f457762117cbcbb982a0224d9f8eb2cd9419.tar.gz
tor-c616f457762117cbcbb982a0224d9f8eb2cd9419.zip
binascii: Fix the base64_encode_nopad() buffer length requirement
Comment-only change. Part of 29660.
Diffstat (limited to 'src/lib/encoding/binascii.c')
-rw-r--r--src/lib/encoding/binascii.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/lib/encoding/binascii.c b/src/lib/encoding/binascii.c
index 187df34243..fc64e014e7 100644
--- a/src/lib/encoding/binascii.c
+++ b/src/lib/encoding/binascii.c
@@ -321,8 +321,10 @@ base64_encode(char *dest, size_t destlen, const char *src, size_t srclen,
return (int) enclen;
}
-/** As base64_encode, but do not add any internal spaces or external padding
- * to the output stream. */
+/** As base64_encode, but do not add any internal spaces, and remove external
+ * padding from the output stream.
+ * dest must be at least base64_encode_size(srclen, 0), including space for
+ * the removed external padding. */
int
base64_encode_nopad(char *dest, size_t destlen,
const uint8_t *src, size_t srclen)