mirror of
https://github.com/yuzu-emu/mbedtls.git
synced 2024-11-26 13:25:42 +01:00
Ensure that mbedtls_pk_parse_key() does not allocate 0 bytes
This commit is contained in:
parent
af77213b72
commit
133ab2c8ee
@ -1210,6 +1210,9 @@ int mbedtls_pk_parse_key( mbedtls_pk_context *pk,
|
||||
{
|
||||
unsigned char *key_copy;
|
||||
|
||||
if( keylen == 0 )
|
||||
return( MBEDTLS_ERR_PK_KEY_INVALID_FORMAT );
|
||||
|
||||
if( ( key_copy = mbedtls_calloc( 1, keylen ) ) == NULL )
|
||||
return( MBEDTLS_ERR_PK_ALLOC_FAILED );
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user