Skip to content

Commit

Permalink
Fix rare crash in TLS handshake.
Browse files Browse the repository at this point in the history
  • Loading branch information
smorlat committed Nov 24, 2020
1 parent 7e54add commit 50c26d8
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/crypto/mbedtls.c
Expand Up @@ -251,8 +251,10 @@ bctbx_list_t *bctbx_x509_certificate_get_subjects(const bctbx_x509_certificate_t

for (; subjectAltNames != NULL; subjectAltNames = subjectAltNames->next){
const mbedtls_asn1_buf *buf = &subjectAltNames->buf;
if (buf->tag == ( MBEDTLS_ASN1_CONTEXT_SPECIFIC | 2 ) || buf->tag == ( MBEDTLS_ASN1_CONTEXT_SPECIFIC | 2 )){
ret = bctbx_list_append(ret, bctbx_strndup((char*)buf->p, buf->len));
if (buf->tag == ( MBEDTLS_ASN1_CONTEXT_SPECIFIC | 2 ) ){
if (buf->p){
ret = bctbx_list_append(ret, bctbx_strndup((char*)buf->p, buf->len));
}
}
}

Expand Down

0 comments on commit 50c26d8

Please sign in to comment.