From 51040b1f07615121e5eaf6e69704d199f76ee1cd Mon Sep 17 00:00:00 2001 From: Hideki Miyazaki Date: Wed, 22 Mar 2023 10:31:58 +0900 Subject: [PATCH] reset alt name list to head --- src/x509.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/x509.c b/src/x509.c index e4c9db6af..d2da2bd88 100644 --- a/src/x509.c +++ b/src/x509.c @@ -3381,8 +3381,15 @@ char* wolfSSL_X509_get_next_altname(WOLFSSL_X509* cert) return NULL; /* already went through them */ - if (cert->altNamesNext == NULL) + if (cert->altNamesNext == NULL) { +#ifdef WOLFSSL_MULTICIRCULATE_ALTNAMELIST + /* Reset altNames List to head + * so that caller can circulate the list again + */ + cert->altNamesNext = cert->altNames; +#endif return NULL; + } ret = cert->altNamesNext->name; #if defined(OPENSSL_ALL) || defined(WOLFSSL_IP_ALT_NAME)