From dbea29eeae016a4a48b91b954f3a4e93ca4072f7 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Thu, 28 May 2015 15:42:01 +0000 Subject: unsafe strncat removed git-svn-id: http://svn.miranda-ng.org/main/trunk@13872 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/Non-IM Contact/src/contactinfo.cpp | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) (limited to 'plugins/Non-IM Contact/src/contactinfo.cpp') diff --git a/plugins/Non-IM Contact/src/contactinfo.cpp b/plugins/Non-IM Contact/src/contactinfo.cpp index 3b037b3159..af83f83cb5 100644 --- a/plugins/Non-IM Contact/src/contactinfo.cpp +++ b/plugins/Non-IM Contact/src/contactinfo.cpp @@ -280,7 +280,7 @@ char* copyReplaceString(char* oldStr, char* newStr, char* findStr, char* replace i += (int)mir_strlen(findStr); } else { - mir_strncat(newStr, &oldStr[i], 1); + strncat(newStr, &oldStr[i], 1); i++; } } @@ -482,7 +482,7 @@ void ExportContact(MCONTACT hContact) INT_PTR ImportContacts(WPARAM wParam, LPARAM lParam) { MCONTACT hContact; - char name[256] = "", program[256] = "", programparam[256] = "", group[256] = "", tooltip[3000] = "", line[2001] = ""; + char name[256] = "", program[256] = "", programparam[256] = "", group[256] = "", line[2001] = ""; int icon = 40072, usetimer = 0, minutes = 1, timer = 0; char fn[MAX_PATH]; int i, j, contactDone = 0; @@ -493,6 +493,8 @@ INT_PTR ImportContacts(WPARAM wParam, LPARAM lParam) if (!file) return 1; + CMStringA tooltip; + while (fgets(line, 2000, file)) { if (!mir_strcmp(line, "\r\n\0")) continue; @@ -529,14 +531,14 @@ INT_PTR ImportContacts(WPARAM wParam, LPARAM lParam) } else if (!strncmp(line, "ToolTip=", mir_strlen("ToolTip="))) { i = (int)mir_strlen("ToolTip="); - mir_strcpy(tooltip, &line[i]); + tooltip = &line[i]; fgets(line, 2000, file); while (!strstr(line, "\r\n")) { - mir_strcat(tooltip, line); + tooltip.Append(line); fgets(line, 2000, file); } // the line that has the - mir_strncat(tooltip, line, SIZEOF(tooltip) - mir_strlen(tooltip)); + tooltip.Append(line); } else if (!strncmp(line, "Icon=", mir_strlen("Icon="))) { i = (int)mir_strlen("Icon="); @@ -656,8 +658,8 @@ INT_PTR ImportContacts(WPARAM wParam, LPARAM lParam) program[0] = '\0'; programparam[0] = '\0'; group[0] = '\0'; - tooltip[0] = '\0'; line[0] = '\0'; + tooltip.Empty(); icon = 40072; usetimer = 0; minutes = 1; -- cgit v1.2.3