- Clean Subject Alternative Name data

This commit is contained in:
Paul Bakker 2012-02-11 18:42:45 +00:00
parent 57b12982b3
commit 8afa70dcd5

View file

@ -497,6 +497,10 @@ static int x509_get_sig( unsigned char **p,
int ret; int ret;
size_t len; size_t len;
if( ( end - *p ) < 1 )
return( POLARSSL_ERR_X509_CERT_INVALID_SIGNATURE +
POLARSSL_ERR_ASN1_OUT_OF_DATA );
sig->tag = **p; sig->tag = **p;
if( ( ret = asn1_get_tag( p, end, &len, ASN1_BIT_STRING ) ) != 0 ) if( ( ret = asn1_get_tag( p, end, &len, ASN1_BIT_STRING ) ) != 0 )
@ -3215,6 +3219,15 @@ void x509_free( x509_cert *crt )
free( seq_prv ); free( seq_prv );
} }
seq_cur = cert_cur->subject_alt_names.next;
while( seq_cur != NULL )
{
seq_prv = seq_cur;
seq_cur = seq_cur->next;
memset( seq_prv, 0, sizeof( x509_sequence ) );
free( seq_prv );
}
if( cert_cur->raw.p != NULL ) if( cert_cur->raw.p != NULL )
{ {
memset( cert_cur->raw.p, 0, cert_cur->raw.len ); memset( cert_cur->raw.p, 0, cert_cur->raw.len );