mirror of
https://github.com/Mbed-TLS/mbedtls.git
synced 2025-07-28 00:21:48 +03:00
Fix memory error in asn1_get_bitstring_null()
When *len is 0, **p would be read, which is out of bounds.
This commit is contained in:
committed by
Paul Bakker
parent
0b2726732e
commit
06dab806ce
@ -220,7 +220,7 @@ int asn1_get_bitstring_null( unsigned char **p, const unsigned char *end,
|
||||
if( ( ret = asn1_get_tag( p, end, len, ASN1_BIT_STRING ) ) != 0 )
|
||||
return( ret );
|
||||
|
||||
if( --*len < 1 || *(*p)++ != 0 )
|
||||
if( (*len)-- < 2 || *(*p)++ != 0 )
|
||||
return( POLARSSL_ERR_ASN1_INVALID_DATA );
|
||||
|
||||
return( 0 );
|
||||
|
Reference in New Issue
Block a user