Deref pointer when using sizeof in x509_get_other_name

Fix for #2716.
This commit is contained in:
Sébastien Duquette 2019-06-23 17:45:26 -04:00
parent 66b7edb108
commit 661d725044
2 changed files with 4 additions and 3 deletions

View File

@ -74,6 +74,7 @@ Bugfix
irwir.
* Enable Suite B with subset of ECP curves. Make sure the code compiles even
if some curves are not defined. Fixes #1591 reported by dbedev.
* Fix partial zeroing in x509_get_other_name. Found and fixed by ekse, #2716.
API Changes
* Extend the MBEDTLS_SSL_EXPORT_KEYS to export the handshake randbytes,

View File

@ -1687,7 +1687,7 @@ static int x509_get_other_name( const mbedtls_x509_buf *subject_alt_name,
if( p + len >= end )
{
mbedtls_platform_zeroize( other_name, sizeof( other_name ) );
mbedtls_platform_zeroize( other_name, sizeof( *other_name ) );
return( MBEDTLS_ERR_X509_INVALID_EXTENSIONS +
MBEDTLS_ERR_ASN1_LENGTH_MISMATCH );
}
@ -1709,7 +1709,7 @@ static int x509_get_other_name( const mbedtls_x509_buf *subject_alt_name,
if( p + len >= end )
{
mbedtls_platform_zeroize( other_name, sizeof( other_name ) );
mbedtls_platform_zeroize( other_name, sizeof( *other_name ) );
return( MBEDTLS_ERR_X509_INVALID_EXTENSIONS +
MBEDTLS_ERR_ASN1_LENGTH_MISMATCH );
}
@ -1725,7 +1725,7 @@ static int x509_get_other_name( const mbedtls_x509_buf *subject_alt_name,
if( p != end )
{
mbedtls_platform_zeroize( other_name,
sizeof( other_name ) );
sizeof( *other_name ) );
return( MBEDTLS_ERR_X509_INVALID_EXTENSIONS +
MBEDTLS_ERR_ASN1_LENGTH_MISMATCH );
}