Skip to content

Commit cdf6e67

Browse files
committed
Fix x509_get1_aia_by_method fallback case
1 parent 91beb04 commit cdf6e67

1 file changed

Lines changed: 8 additions & 1 deletion

File tree

src/x509.c

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15179,13 +15179,20 @@ static WOLFSSL_STACK* x509_get1_aia_by_method(WOLFSSL_X509* x, word32 method,
1517915179
}
1518015180
}
1518115181
}
15182-
if (fallback != NULL && fallbackSz > 0) {
15182+
/* Only use fallback when nothing was found in the list */
15183+
if (wolfSSL_sk_num(ret) == 0 && fallback != NULL && fallbackSz > 0) {
1518315184
if (x509_aia_append_string(ret, fallback, (word32)fallbackSz) != 0) {
1518415185
wolfSSL_X509_email_free(ret);
1518515186
return NULL;
1518615187
}
1518715188
}
1518815189

15190+
/* Return NULL when empty */
15191+
if (wolfSSL_sk_num(ret) == 0) {
15192+
wolfSSL_X509_email_free(ret);
15193+
ret = NULL;
15194+
}
15195+
1518915196
return ret;
1519015197
}
1519115198

0 commit comments

Comments
 (0)