Fixed a possible buffer overflow issue

This commit is contained in:
Chris 2013-06-17 21:49:29 +02:00
parent cd548da226
commit 44f6f16953

View File

@ -527,7 +527,7 @@ BOOL tls_match_hostname(char *pattern, int pattern_length, char *hostname)
return TRUE;
}
if (pattern_length > 2 && pattern[0] == '*' && pattern[1] == '.')
if (pattern_length > 2 && pattern[0] == '*' && pattern[1] == '.' && strlen(hostname) >= pattern_length)
{
char *check_hostname = &hostname[ strlen(hostname) - pattern_length+1 ];
if (memcmp((void*) check_hostname, (void*) &pattern[1], pattern_length - 1) == 0 )