From 95f8d7420218470b918555841d1359139fde3ca2 Mon Sep 17 00:00:00 2001 From: Colton Willey Date: Tue, 22 Oct 2024 15:59:49 -0700 Subject: [PATCH] Fix loop to decrement --- src/x509_str.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/x509_str.c b/src/x509_str.c index 44e104ba6..012f41d74 100644 --- a/src/x509_str.c +++ b/src/x509_str.c @@ -365,13 +365,14 @@ int wolfSSL_X509_verify_cert(WOLFSSL_X509_STORE_CTX* ctx) (wolfSSL_sk_X509_num(certs) > numInterAdd)) { for (i = wolfSSL_sk_X509_num(certs) - 1; i > (numInterAdd > 0 ? numInterAdd - 1 : 0); - i++) { + i--) { tmp = wolfSSL_sk_X509_value(certs, i); - if (wolfSSL_X509_NAME_cmp( + if (tmp != NULL && wolfSSL_X509_NAME_cmp( &issuer->subject, &tmp->subject) == 0) { ret = WOLFSSL_SUCCESS; break; } + tmp = NULL; } } }