case insensitivity fix for domain name check
This commit is contained in:
parent
8295d8bb4a
commit
f45d0709b3
@ -198,12 +198,14 @@ enum {
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(HAVE_ECC) || defined(HAVE_OCSP)
|
||||
#ifndef CTYPE_USER
|
||||
#include <ctype.h>
|
||||
#ifndef CTYPE_USER
|
||||
#include <ctype.h>
|
||||
#if defined(HAVE_ECC) || defined(HAVE_OCSP)
|
||||
#define XTOUPPER(c) toupper((c))
|
||||
#define XISALPHA(c) isalpha((c))
|
||||
#endif
|
||||
/* needed by CyaSSL_check_domain_name() */
|
||||
#define XTOLOWER(c) tolower((c))
|
||||
#endif
|
||||
|
||||
|
||||
|
@ -2909,15 +2909,15 @@ static int MatchDomainName(const char* pattern, int len, const char* str)
|
||||
if (pattern == NULL || str == NULL || len <= 0)
|
||||
return 0;
|
||||
|
||||
while (len > 0 && (p = (char)(*pattern++))) {
|
||||
while (len > 0 && (p = (char)XTOLOWER(*pattern++))) {
|
||||
if (p == '*') {
|
||||
while (--len > 0 && (p = (char)(*pattern++)) == '*')
|
||||
while (--len > 0 && (p = (char)XTOLOWER(*pattern++)) == '*')
|
||||
;
|
||||
|
||||
if (len == 0)
|
||||
p = '\0';
|
||||
|
||||
while ( (s = (char)(*str)) != '\0') {
|
||||
while ( (s = (char)XTOLOWER(*str)) != '\0') {
|
||||
if (s == p)
|
||||
break;
|
||||
if (s == '.')
|
||||
@ -2926,7 +2926,7 @@ static int MatchDomainName(const char* pattern, int len, const char* str)
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (p != (char)(*str))
|
||||
if (p != (char)XTOLOWER(*str))
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user