Index: http.c =================================================================== RCS file: /cvsroot/mplayer/main/libmpdemux/http.c,v retrieving revision 1.34 diff -u -r1.34 http.c --- http.c 9 Feb 2006 14:07:57 -0000 1.34 +++ http.c 7 Mar 2006 16:21:49 -0000 @@ -659,7 +659,7 @@ int base64_encode(const void *enc, int encLen, char *out, int outMax) { - static const char b64[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_"; + static const char b64[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; unsigned char *encBuf; int outLen; @@ -670,6 +670,7 @@ outLen = 0; bits = 0; shift = 0; + outMax &= ~3; while( outLen0 ) { @@ -685,9 +686,12 @@ bits <<= 6 - shift; shift = 6; } else { - // Terminate with Mime style '=' - *out = '='; - outLen++; + // As per RFC 2045, section 6.8, + // pad output as necessary: 0 to 2 '=' chars. + while( outLen & 3 ){ + *out++ = '='; + outLen++; + } return outLen; }