From 65290afe0adb928b9836c2f15fbc0159d9969889 Mon Sep 17 00:00:00 2001 From: Geza Lore Date: Thu, 27 Oct 2022 17:39:53 +0100 Subject: [PATCH] Fix VString::endsWith when suffix is longer than input string. --- src/V3String.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/V3String.cpp b/src/V3String.cpp index 4b118a537..af6122e7d 100644 --- a/src/V3String.cpp +++ b/src/V3String.cpp @@ -184,6 +184,7 @@ bool VString::startsWith(const string& str, const string& prefix) { } bool VString::endsWith(const string& str, const string& suffix) { + if (str.length() < suffix.length()) return false; return str.compare(str.length() - suffix.length(), suffix.length(), suffix) == 0; }