Ankur Tyagi 0722748606 wolfssl: patch CVE-2026-5772
Backport commits from the PR[1] mentioned in the nvd[2]

[1]https://github.com/wolfSSL/wolfssl/pull/10119
[2]https://nvd.nist.gov/vuln/detail/CVE-2026-5772

Signed-off-by: Ankur Tyagi <ankur.tyagi85@gmail.com>
Signed-off-by: Anuj Mittal <anuj.mittal@oss.qualcomm.com>
2026-05-08 07:28:45 +05:30

36 lines
1.3 KiB
Diff

From 89938195b946f709f40f653d90ce215f868c7d79 Mon Sep 17 00:00:00 2001
From: Kareem <kareem@wolfssl.com>
Date: Wed, 1 Apr 2026 11:50:17 -0700
Subject: [PATCH] Rework check to avoid changing existing logic.
CVE: CVE-2026-5772
Upstream-Status: Backport [https://github.com/wolfSSL/wolfssl/commit/90d631232308a59a03f6f6f455f9ac373db7af3d]
Signed-off-by: Ankur Tyagi <ankur.tyagi85@gmail.com>
---
src/internal.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/src/internal.c b/src/internal.c
index 1c217b902..6af03cbf0 100644
--- a/src/internal.c
+++ b/src/internal.c
@@ -12898,7 +12898,7 @@ int MatchDomainName(const char* pattern, int patternLen, const char* str,
if (pattern == NULL || str == NULL || patternLen <= 0 || strLen == 0)
return 0;
- while (patternLen > 0 && strLen > 0) {
+ while (patternLen > 0) {
/* Get the next pattern char to evaluate */
char p = (char)XTOLOWER((unsigned char)*pattern);
if (p == '\0')
@@ -12964,6 +12964,9 @@ int MatchDomainName(const char* pattern, int patternLen, const char* str,
wildcardEligible = 0;
}
+ if (strLen == 0)
+ return 0;
+
/* Simple case, pattern match exactly */
if (p != (char)XTOLOWER((unsigned char) *str))
return 0;