From 140c9057ea834cd5986dd397bd434203658f5f08 Mon Sep 17 00:00:00 2001 From: Akash Mozumdar Date: Thu, 13 Jun 2019 04:08:40 -0400 Subject: [PATCH] account for null terminator in repetition filter --- GUI/host/util.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/GUI/host/util.cpp b/GUI/host/util.cpp index fb9ee2b..66ae7cb 100644 --- a/GUI/host/util.cpp +++ b/GUI/host/util.cpp @@ -313,7 +313,7 @@ namespace Util { wchar_t* end = text.data() + text.size(); for (int length = text.size() / 3; length > 6; --length) - if (wcsncmp(end - length * 3, end - length * 2, length) == 0 && wcsncmp(end - length * 3, end - length * 1, length) == 0) + if (memcmp(end - length * 3, end - length * 2, length * sizeof(wchar_t)) == 0 && memcmp(end - length * 3, end - length * 1, length * sizeof(wchar_t)) == 0) return RemoveRepetition(text = std::wstring(end - length, length)), true; return false; }