Skip to content

Commit

Permalink
Fix bug in x509_get_attr_type_value()
Browse files Browse the repository at this point in the history
  • Loading branch information
Hanno Becker committed Feb 13, 2019
1 parent 827d90b commit 0181103
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions library/x509.c
Original file line number Diff line number Diff line change
Expand Up @@ -354,6 +354,8 @@ static int x509_get_attr_type_value( unsigned char **p,
MBEDTLS_ASN1_CONSTRUCTED | MBEDTLS_ASN1_SEQUENCE ) ) != 0 )
return( MBEDTLS_ERR_X509_INVALID_NAME + ret );

end = *p + len;

if( ( end - *p ) < 1 )
return( MBEDTLS_ERR_X509_INVALID_NAME +
MBEDTLS_ERR_ASN1_OUT_OF_DATA );
Expand Down Expand Up @@ -387,6 +389,12 @@ static int x509_get_attr_type_value( unsigned char **p,
val->p = *p;
*p += val->len;

if( *p != end )
{
return( MBEDTLS_ERR_X509_INVALID_NAME +
MBEDTLS_ERR_ASN1_LENGTH_MISMATCH );
}

cur->next = NULL;

return( 0 );
Expand Down

0 comments on commit 0181103

Please sign in to comment.