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:
parent
0b2726732e
commit
06dab806ce
2 changed files with 2 additions and 2 deletions
|
@ -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 );
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue