- Handle empty certificate subject names

This commit is contained in:
Paul Bakker 2012-06-27 11:51:09 +00:00
parent e4791f3936
commit cefb396a77
2 changed files with 8 additions and 1 deletions

View file

@ -39,6 +39,7 @@ Bugfix
#52)
* Handle encryption with private key and decryption with public key as per
RFC 2313
* Handle empty certificate subject names
Security
* Fixed potential memory corruption on miscrafted client messages (found by

View file

@ -1263,7 +1263,7 @@ int x509parse_crt_der( x509_cert *crt, const unsigned char *buf, size_t buflen )
return( POLARSSL_ERR_X509_CERT_INVALID_FORMAT + ret );
}
if( ( ret = x509_get_name( &p, p + len, &crt->subject ) ) != 0 )
if( len && ( ret = x509_get_name( &p, p + len, &crt->subject ) ) != 0 )
{
x509_free( crt );
return( ret );
@ -2518,6 +2518,12 @@ int x509parse_dn_gets( char *buf, size_t size, const x509_name *dn )
while( name != NULL )
{
if( !name->oid.p )
{
name = name->next;
continue;
}
if( name != dn )
{
ret = snprintf( p, n, ", " );