From 51ef7cd65d909e2cc97a99c73758de97e11b4c50 Mon Sep 17 00:00:00 2001 From: cora32 Date: Sat, 17 Jan 2015 04:33:03 +0300 Subject: [PATCH] -- --- finder.cpp | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/finder.cpp b/finder.cpp index 86811f3..bc14c2e 100644 --- a/finder.cpp +++ b/finder.cpp @@ -408,19 +408,22 @@ int ContentFilter(char *buff, int port, char *ip, char *cp) if(buff != NULL) { int res = 0; - std::string tempString = toLowerStr(buff); - int sz = tempString.size(); - char *lBuff = new char[sz + 1]; - ZeroMemory(lBuff, sz + 1); + std::string tempString = ""; if(strstr(cp, "1251") != NULL) { - strcpy(lBuff, toLowerStr(buff).c_str()); + tempString = toLowerStr(buff); } else { - strcpy(lBuff, toLowerStr(xcode(buff, CP_UTF8, CP_ACP).c_str()).c_str()); + tempString = toLowerStr(xcode(buff, CP_UTF8, CP_ACP).c_str()); }; + + int sz = tempString.size(); + char *lBuff = new char[sz + 1]; + ZeroMemory(lBuff, sz + 1); + strcpy(lBuff, tempString.c_str()); + memset(lBuff + sz, '\0', 1); if(sz <= 500) {