tr_base64_decode() now decodes both data with, and without, newlines. thanks to dm1024 for helping track this down.

This commit is contained in:
Charles Kerr 2008-05-22 03:42:26 +00:00
parent e6f66b1d07
commit 07ae5bf965
1 changed files with 11 additions and 0 deletions

View File

@ -1078,6 +1078,17 @@ tr_base64_decode( const void * input, int length, int * setme_len )
bmem = BIO_new_mem_buf( (unsigned char*)input, length );
bmem = BIO_push( b64, bmem );
retlen = BIO_read( bmem, ret, length );
if( !retlen )
{
/* try again, but with the BIO_FLAGS_BASE64_NO_NL flag */
BIO_free_all( bmem );
b64 = BIO_new( BIO_f_base64( ) );
BIO_set_flags( b64, BIO_FLAGS_BASE64_NO_NL );
bmem = BIO_new_mem_buf( (unsigned char*)input, length );
bmem = BIO_push( b64, bmem );
retlen = BIO_read( bmem, ret, length );
}
if( setme_len )
*setme_len = retlen;