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:
Manuel Pégourié-Gonnard 2013-08-15 12:24:43 +02:00 committed by Paul Bakker
parent 0b2726732e
commit 06dab806ce
2 changed files with 2 additions and 2 deletions

View file

@ -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 );