1
0
mirror of https://github.com/Mbed-TLS/mbedtls.git synced 2025-08-01 10:06:53 +03:00

Fix 1 byte overread in mbedtls_asn1_get_int()

This commit is contained in:
Andres AG
2016-09-26 09:52:41 +01:00
committed by Simon Butcher
parent cd153278eb
commit 776a6fcd1a
2 changed files with 3 additions and 3 deletions

View File

@ -153,7 +153,7 @@ int mbedtls_asn1_get_int( unsigned char **p,
if( ( ret = mbedtls_asn1_get_tag( p, end, &len, MBEDTLS_ASN1_INTEGER ) ) != 0 )
return( ret );
if( len > sizeof( int ) || ( **p & 0x80 ) != 0 )
if( len == 0 || len > sizeof( int ) || ( **p & 0x80 ) != 0 )
return( MBEDTLS_ERR_ASN1_INVALID_LENGTH );
*val = 0;