mirror of
https://git.suyu.dev/suyu/mbedtls.git
synced 2025-12-30 19:25:59 +01:00
Avoid in-out length in base64
This commit is contained in:
parent
3335205a21
commit
ba56136b5c
6 changed files with 41 additions and 45 deletions
|
|
@ -96,14 +96,14 @@ int convert_pem_to_der( const unsigned char *input, size_t ilen,
|
|||
if( s2 <= s1 || s2 > end )
|
||||
return( -1 );
|
||||
|
||||
ret = mbedtls_base64_decode( NULL, &len, (const unsigned char *) s1, s2 - s1 );
|
||||
ret = mbedtls_base64_decode( NULL, 0, &len, (const unsigned char *) s1, s2 - s1 );
|
||||
if( ret == MBEDTLS_ERR_BASE64_INVALID_CHARACTER )
|
||||
return( ret );
|
||||
|
||||
if( len > *olen )
|
||||
return( -1 );
|
||||
|
||||
if( ( ret = mbedtls_base64_decode( output, &len, (const unsigned char *) s1,
|
||||
if( ( ret = mbedtls_base64_decode( output, len, &len, (const unsigned char *) s1,
|
||||
s2 - s1 ) ) != 0 )
|
||||
{
|
||||
return( ret );
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue