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