diff --git a/ChangeLog b/ChangeLog index 517b45e7f..f122aa6b2 100644 --- a/ChangeLog +++ b/ChangeLog @@ -58,6 +58,7 @@ Bugfix key exchanges enabled needs certificates. This fixes a possible interop issue with some servers when a zero-length extension was sent. (Reported by Peter Dettman.) + * On a 0-length input, base64_encode() did not correctly set output length. Changes * Use deterministic nonces for AEAD ciphers in TLS by default (possible to diff --git a/library/base64.c b/library/base64.c index d3814d63f..0c6b46c7d 100644 --- a/library/base64.c +++ b/library/base64.c @@ -82,7 +82,10 @@ int base64_encode( unsigned char *dst, size_t *dlen, unsigned char *p; if( slen == 0 ) + { + *dlen = 0; return( 0 ); + } n = ( slen << 3 ) / 6;