mirror of
https://github.com/yuzu-emu/mbedtls
synced 2024-11-24 15:38:08 +00:00
Ensure memcpy is not called with NULL and 0 args in x509 module
This commit is contained in:
parent
f1ee63562a
commit
cb5123fa86
1 changed files with 3 additions and 1 deletions
|
@ -294,7 +294,9 @@ int mbedtls_x509_crl_parse_der( mbedtls_x509_crl *chain,
|
|||
/*
|
||||
* Copy raw DER-encoded CRL
|
||||
*/
|
||||
if( buflen != 0 && ( ( p = mbedtls_calloc( 1, buflen ) ) == NULL ) )
|
||||
if( buflen == 0 )
|
||||
return( MBEDTLS_ERR_X509_INVALID_FORMAT );
|
||||
else if( ( p = mbedtls_calloc( 1, buflen ) ) == NULL )
|
||||
return( MBEDTLS_ERR_X509_ALLOC_FAILED );
|
||||
|
||||
memcpy( p, buf, buflen );
|
||||
|
|
Loading…
Reference in a new issue