From: teor Date: Fri, 5 Apr 2019 05:10:36 +0000 (+1000) Subject: binascii: Fix the base64_encode_nopad() buffer length requirement X-Git-Tag: tor-0.4.1.1-alpha~81^2~2 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=c616f457762117cbcbb982a0224d9f8eb2cd9419;p=thirdparty%2Ftor.git binascii: Fix the base64_encode_nopad() buffer length requirement Comment-only change. Part of 29660. --- 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)