From 60225211186788c4e404cb241d97ca20d2fea3df Mon Sep 17 00:00:00 2001 From: hokasha2016 <46494088+hokasha2016@users.noreply.github.com> Date: Sat, 20 Apr 2019 12:55:27 -0400 Subject: [PATCH] Fix #7871: String::StartsWith() returns true if source is shorter than match --- src/openrct2/core/String.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/openrct2/core/String.cpp b/src/openrct2/core/String.cpp index 6406728e98..68da671696 100644 --- a/src/openrct2/core/String.cpp +++ b/src/openrct2/core/String.cpp @@ -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; }