Fix #7871: String::StartsWith() returns true if source is shorter than match

This commit is contained in:
hokasha2016 2019-04-20 12:55:27 -04:00 committed by Michael Steenbeek
parent 82c73e18c7
commit 6022521118
1 changed files with 4 additions and 4 deletions

View File

@ -184,9 +184,9 @@ namespace String
{
if (ignoreCase)
{
while (*str != '\0' && *match != '\0')
while (*match != '\0')
{
if (tolower(*str++) != tolower(*match++))
if (*str == '\0' || tolower(*str++) != tolower(*match++))
{
return false;
}
@ -195,9 +195,9 @@ namespace String
}
else
{
while (*str != '\0' && *match != '\0')
while (*match != '\0')
{
if (*str++ != *match++)
if (*str == '\0' || *str++ != *match++)
{
return false;
}