From 6fcfba2c46a456677b5825a899469ba4e8905448 Mon Sep 17 00:00:00 2001 From: Kirill Volinsky Date: Sat, 23 May 2015 17:49:58 +0000 Subject: replace strncpy to mir_strncpy git-svn-id: http://svn.miranda-ng.org/main/trunk@13785 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/Alarms/src/frame.cpp | 8 ++--- plugins/BossKeyPlus/src/BossKey.cpp | 2 +- .../ClientChangeNotify/src/CommonLibs/CString.h | 2 +- plugins/Clist_nicer/src/clui.cpp | 18 ++++++------ plugins/Clist_nicer/src/extBackg.cpp | 2 +- plugins/Clist_nicer/src/viewmodes.cpp | 8 ++--- plugins/CmdLine/MimCmd/src/commands.cpp | 2 +- plugins/CmdLine/src/utils.cpp | 6 ++-- plugins/CrashDumper/src/dumper.cpp | 2 +- plugins/CrashDumper/src/upload.cpp | 2 +- plugins/DbEditorPP/src/copymodule.cpp | 2 +- plugins/DbEditorPP/src/exportimport.cpp | 8 ++--- plugins/DbEditorPP/src/headers.h | 2 +- plugins/DbEditorPP/src/main.cpp | 6 ++-- plugins/FloatingContacts/src/filedrop.cpp | 6 ++-- plugins/FloatingContacts/src/main.cpp | 2 +- plugins/Folders/src/services.cpp | 2 +- plugins/HTTPServer/src/GuiElements.cpp | 8 ++--- plugins/HTTPServer/src/HttpUser.cpp | 4 +-- plugins/HTTPServer/src/IndexHTML.cpp | 14 ++++----- plugins/HTTPServer/src/IndexXML.cpp | 16 +++++----- plugins/IEView/src/ScriverHTMLBuilder.cpp | 4 +-- plugins/ListeningTo/src/listeningto.cpp | 2 +- plugins/LotusNotify/src/LotusNotify.cpp | 4 +-- plugins/MenuItemEx/src/main.cpp | 6 ++-- plugins/MirOTR/src/dbfilter.cpp | 6 ++-- plugins/MirOTR/src/striphtml.cpp | 2 +- plugins/NewAwaySysMod/src/CString.h | 2 +- plugins/New_GPG/src/main.cpp | 8 ++--- plugins/New_GPG/src/messages.cpp | 6 ++-- plugins/New_GPG/src/utilities.cpp | 2 +- plugins/Non-IM Contact/src/namereplacing.cpp | 8 ++--- plugins/NotesAndReminders/src/options.cpp | 8 ++--- plugins/NotesAndReminders/src/reminders.cpp | 2 +- plugins/RemovePersonalSettings/src/rps.cpp | 2 +- plugins/Scriver/src/msgoptions.cpp | 8 ++--- plugins/SecureIM/src/commonheaders.cpp | 4 +-- plugins/SecureIM/src/crypt_lists.cpp | 2 +- plugins/SecureIM/src/main.cpp | 8 ++--- plugins/SecureIM/src/options.cpp | 8 ++--- plugins/SecureIM/src/svcs_proto.cpp | 2 +- plugins/SeenPlugin/src/utils.cpp | 4 +-- plugins/Sessions/Src/Utils.cpp | 2 +- plugins/SimpleStatusMsg/src/main.cpp | 6 ++-- plugins/SmileyAdd/src/dlgboxsubclass.cpp | 2 +- plugins/SmileyAdd/src/download.cpp | 2 +- plugins/SpellChecker/src/utils.cpp | 2 +- plugins/StatusPlugins/KeepStatus/keepstatus.cpp | 2 +- plugins/TabSRMM/src/chat/options.cpp | 20 ++++++------- plugins/TabSRMM/src/generic_msghandlers.cpp | 4 +-- plugins/TabSRMM/src/sendlater.cpp | 6 ++-- plugins/TabSRMM/src/themes.cpp | 2 +- plugins/TipperYM/src/mir_smileys.cpp | 6 ++-- plugins/TipperYM/src/options.cpp | 10 +++---- plugins/TipperYM/src/popwin.cpp | 4 +-- plugins/TooltipNotify/src/TooltipNotify.cpp | 8 ++--- plugins/TrafficCounter/src/TrafficCounter.cpp | 4 +-- plugins/Utils/mir_buffer.h | 2 +- plugins/Variables/src/parse_inet.cpp | 4 +-- plugins/Weather/src/weather_ini.cpp | 4 +-- plugins/Weather/src/weather_svcs.cpp | 2 +- plugins/WebView/src/webview_alerts.cpp | 6 ++-- plugins/WebView/src/webview_cleanup.cpp | 34 +++++++++++----------- plugins/WebView/src/webview_datawnd.cpp | 2 +- plugins/WebView/src/webview_getdata.cpp | 4 +-- plugins/WhenWasIt/src/utils.cpp | 8 ++--- plugins/YAMN/src/browser/mailbrowser.cpp | 2 +- plugins/YAMN/src/mails/decode.cpp | 2 +- plugins/YAMN/src/mails/mails.cpp | 2 +- plugins/YARelay/src/main.cpp | 2 +- plugins/YahooGroups/src/utils.cpp | 8 ++--- plugins/helpers/gen_helpers.cpp | 2 +- 72 files changed, 192 insertions(+), 192 deletions(-) (limited to 'plugins') diff --git a/plugins/Alarms/src/frame.cpp b/plugins/Alarms/src/frame.cpp index 18659fec9c..021e718ee4 100644 --- a/plugins/Alarms/src/frame.cpp +++ b/plugins/Alarms/src/frame.cpp @@ -582,10 +582,10 @@ int CreateFrame() SendMessage(hwnd_plugin, WMU_INITIALIZE, 0, 0); font_id.cbSize = sizeof(font_id); - strncpy(font_id.group, LPGEN("Frames"), sizeof(font_id.group)); - strncpy(font_id.name, LPGEN("Alarm reminders"), sizeof(font_id.name)); - strncpy(font_id.dbSettingsGroup, MODULE, sizeof(font_id.dbSettingsGroup)); - strncpy(font_id.prefix, "Font", sizeof(font_id.prefix)); + mir_strncpy(font_id.group, LPGEN("Frames"), sizeof(font_id.group)); + mir_strncpy(font_id.name, LPGEN("Alarm reminders"), sizeof(font_id.name)); + mir_strncpy(font_id.dbSettingsGroup, MODULE, sizeof(font_id.dbSettingsGroup)); + mir_strncpy(font_id.prefix, "Font", sizeof(font_id.prefix)); font_id.order = 0; FontRegister(&font_id); diff --git a/plugins/BossKeyPlus/src/BossKey.cpp b/plugins/BossKeyPlus/src/BossKey.cpp index 97e20e9dc8..1140b09658 100644 --- a/plugins/BossKeyPlus/src/BossKey.cpp +++ b/plugins/BossKeyPlus/src/BossKey.cpp @@ -384,7 +384,7 @@ LRESULT CALLBACK ListenWndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lPara if (!db_get_s(NULL, MOD_NAME, "password", &dbVar)) { g_fPassRequested = true; - strncpy(g_password, dbVar.pszVal, MAXPASSLEN); + mir_strncpy(g_password, dbVar.pszVal, MAXPASSLEN); db_free(&dbVar); int res = DialogBox(g_hInstance, (MAKEINTRESOURCE(IDD_PASSDIALOGNEW)), GetForegroundWindow(), DlgStdInProc); diff --git a/plugins/ClientChangeNotify/src/CommonLibs/CString.h b/plugins/ClientChangeNotify/src/CommonLibs/CString.h index b2a1c4accf..12e94ca80a 100644 --- a/plugins/ClientChangeNotify/src/CommonLibs/CString.h +++ b/plugins/ClientChangeNotify/src/CommonLibs/CString.h @@ -37,7 +37,7 @@ __inline LPCSTR My_strstr(LPCSTR lpString1, LPCSTR lpString2) {return strstr(lpS __inline LPWSTR My_strstr(LPCWSTR lpString1, LPCWSTR lpString2) {return (LPWSTR)wcsstr(lpString1, lpString2);} __inline LPSTR My_lstrcpy(LPSTR lpString1, LPCSTR lpString2) {return mir_strcpy(lpString1, lpString2);} __inline LPWSTR My_lstrcpy(LPWSTR lpString1, LPCWSTR lpString2) {return mir_wstrcpy(lpString1, lpString2);} -__inline LPSTR My_strncpy(LPSTR lpString1, LPCSTR lpString2, int Len) {return strncpy(lpString1, lpString2, Len);} +__inline LPSTR My_strncpy(LPSTR lpString1, LPCSTR lpString2, int Len) {return mir_strncpy(lpString1, lpString2, Len);} __inline LPWSTR My_strncpy(LPWSTR lpString1, LPCWSTR lpString2, int Len) {return wcsncpy(lpString1, lpString2, Len);} __inline LPSTR My_strlwr(LPSTR lpString) {return _strlwr(lpString);} __inline LPWSTR My_strlwr(LPWSTR lpString) {return _wcslwr(lpString);} diff --git a/plugins/Clist_nicer/src/clui.cpp b/plugins/Clist_nicer/src/clui.cpp index c066d54371..add59df1ed 100644 --- a/plugins/Clist_nicer/src/clui.cpp +++ b/plugins/Clist_nicer/src/clui.cpp @@ -2011,7 +2011,7 @@ void FS_RegisterFonts() { FontIDT fid = { sizeof(fid) }; _tcsncpy(fid.group, LPGENT("Contact list"), SIZEOF(fid.group)); - strncpy(fid.dbSettingsGroup, "CLC", 5); + mir_strncpy(fid.dbSettingsGroup, "CLC", 5); fid.flags = FIDF_DEFAULTVALID | FIDF_ALLOWEFFECTS | FIDF_APPENDNAME | FIDF_SAVEPOINTSIZE; HDC hdc = GetDC(NULL); @@ -2032,7 +2032,7 @@ void FS_RegisterFonts() char idstr[10]; mir_snprintf(idstr, SIZEOF(idstr), "Font%d", i); - strncpy(fid.prefix, idstr, SIZEOF(fid.prefix)); + mir_strncpy(fid.prefix, idstr, SIZEOF(fid.prefix)); fid.order = i; FontRegisterT(&fid); } @@ -2042,34 +2042,34 @@ void FS_RegisterFonts() ColourIDT colourid = {0}; colourid.cbSize = sizeof(colourid); colourid.order = 0; - strncpy(colourid.dbSettingsGroup, "CLC", sizeof(colourid.dbSettingsGroup)); + mir_strncpy(colourid.dbSettingsGroup, "CLC", sizeof(colourid.dbSettingsGroup)); - strncpy(colourid.setting, "BkColour", sizeof(colourid.setting)); + mir_strncpy(colourid.setting, "BkColour", sizeof(colourid.setting)); _tcsncpy(colourid.name, LPGENT("Background"), SIZEOF(colourid.name)); _tcsncpy(colourid.group, LPGENT("Contact list"), SIZEOF(colourid.group)); colourid.defcolour = CLCDEFAULT_BKCOLOUR; ColourRegisterT(&colourid); - strncpy(colourid.setting, "SelTextColour", sizeof(colourid.setting)); + mir_strncpy(colourid.setting, "SelTextColour", sizeof(colourid.setting)); _tcsncpy(colourid.name, LPGENT("Selected text"), SIZEOF(colourid.name)); colourid.order = 1; colourid.defcolour = CLCDEFAULT_SELTEXTCOLOUR; ColourRegisterT(&colourid); - strncpy(colourid.setting, "HotTextColour", sizeof(colourid.setting)); + mir_strncpy(colourid.setting, "HotTextColour", sizeof(colourid.setting)); _tcsncpy(colourid.name, LPGENT("Hottrack text"), SIZEOF(colourid.name)); colourid.order = 1; colourid.defcolour = CLCDEFAULT_HOTTEXTCOLOUR; ColourRegisterT(&colourid); - strncpy(colourid.setting, "QuickSearchColour", sizeof(colourid.setting)); + mir_strncpy(colourid.setting, "QuickSearchColour", sizeof(colourid.setting)); _tcsncpy(colourid.name, LPGENT("Quicksearch text"), SIZEOF(colourid.name)); colourid.order = 1; colourid.defcolour = CLCDEFAULT_QUICKSEARCHCOLOUR; ColourRegisterT(&colourid); - strncpy(colourid.dbSettingsGroup, "CLUI", sizeof(colourid.dbSettingsGroup)); - strncpy(colourid.setting, "clr_frameborder", sizeof(colourid.setting)); + mir_strncpy(colourid.dbSettingsGroup, "CLUI", sizeof(colourid.dbSettingsGroup)); + mir_strncpy(colourid.setting, "clr_frameborder", sizeof(colourid.setting)); _tcsncpy(colourid.name, LPGENT("Embedded frames border"), SIZEOF(colourid.name)); colourid.order = 1; colourid.defcolour = RGB(40, 40, 40); diff --git a/plugins/Clist_nicer/src/extBackg.cpp b/plugins/Clist_nicer/src/extBackg.cpp index bf285973c1..2b82577b11 100644 --- a/plugins/Clist_nicer/src/extBackg.cpp +++ b/plugins/Clist_nicer/src/extBackg.cpp @@ -774,7 +774,7 @@ void IMG_ReadItem(const char *itemname, const char *szFileName) done_with_glyph: - strncpy(tmpItem.szName, &itemname[1], sizeof(tmpItem.szName)); + mir_strncpy(tmpItem.szName, &itemname[1], sizeof(tmpItem.szName)); tmpItem.szName[sizeof(tmpItem.szName) - 1] = 0; _splitpath(szFileName, szDrive, szPath, NULL, NULL); mir_snprintf(szFinalName, SIZEOF(szFinalName), "%s\\%s\\%s", szDrive, szPath, buffer); diff --git a/plugins/Clist_nicer/src/viewmodes.cpp b/plugins/Clist_nicer/src/viewmodes.cpp index d18dddb6d1..c168e671fe 100644 --- a/plugins/Clist_nicer/src/viewmodes.cpp +++ b/plugins/Clist_nicer/src/viewmodes.cpp @@ -447,7 +447,7 @@ void UpdateFilters() szBuf = (char *)malloc(iLen + 1); SendDlgItemMessageA(clvmHwnd, IDC_VIEWMODES, LB_GETTEXT, clvm_curItem, (LPARAM)szBuf); - strncpy(g_szModename, szBuf, sizeof(g_szModename)); + mir_strncpy(g_szModename, szBuf, sizeof(g_szModename)); g_szModename[sizeof(g_szModename) - 1] = 0; mir_snprintf(szTemp, SIZEOF(szTemp), Translate("Current view mode: %s"), g_szModename); SetDlgItemTextA(clvmHwnd, IDC_CURVIEWMODE2, szTemp); @@ -1051,7 +1051,7 @@ void ApplyViewMode(const char *name) mir_snprintf(szSetting, SIZEOF(szSetting), "%c%s_PF", 246, name); if (!cfg::getString(NULL, CLVM_MODULE, szSetting, &dbv)) { if (mir_strlen(dbv.pszVal) >= 2) { - strncpy(cfg::dat.protoFilter, dbv.pszVal, sizeof(cfg::dat.protoFilter)); + mir_strncpy(cfg::dat.protoFilter, dbv.pszVal, sizeof(cfg::dat.protoFilter)); cfg::dat.protoFilter[sizeof(cfg::dat.protoFilter) - 1] = 0; cfg::dat.bFilterEffective |= CLVM_FILTER_PROTOS; } @@ -1084,11 +1084,11 @@ void ApplyViewMode(const char *name) DWORD timerexpire; mir_snprintf(szSetting, SIZEOF(szSetting), "%c%s_OPT", 246, name); timerexpire = LOWORD(cfg::getDword(CLVM_MODULE, szSetting, 0)); - strncpy(cfg::dat.old_viewmode, cfg::dat.current_viewmode, 256); + mir_strncpy(cfg::dat.old_viewmode, cfg::dat.current_viewmode, 256); cfg::dat.old_viewmode[255] = 0; SetTimer(g_hwndViewModeFrame, TIMERID_VIEWMODEEXPIRE, timerexpire * 1000, NULL); } - strncpy(cfg::dat.current_viewmode, name, 256); + mir_strncpy(cfg::dat.current_viewmode, name, 256); cfg::dat.current_viewmode[255] = 0; if (cfg::dat.filterFlags & CLVM_USELASTMSG) { diff --git a/plugins/CmdLine/MimCmd/src/commands.cpp b/plugins/CmdLine/MimCmd/src/commands.cpp index 2cbdfe7430..5154c0012b 100644 --- a/plugins/CmdLine/MimCmd/src/commands.cpp +++ b/plugins/CmdLine/MimCmd/src/commands.cpp @@ -22,7 +22,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. inline char *STRNCPY(char *output, const char *input, size_t size) { - char *res = strncpy(output, input, size); + char *res = mir_strncpy(output, input, size); output[size - 1] = 0; return res; diff --git a/plugins/CmdLine/src/utils.cpp b/plugins/CmdLine/src/utils.cpp index b7dce2a279..c954533e01 100644 --- a/plugins/CmdLine/src/utils.cpp +++ b/plugins/CmdLine/src/utils.cpp @@ -134,7 +134,7 @@ int GetStringFromDatabase(MCONTACT hContact, char *szModule, char *szSettingName res = 0; size_t tmp = mir_strlen(dbv.pszVal); len = (tmp < size - 1) ? tmp : size - 1; - strncpy(szResult, dbv.pszVal, len); + mir_strncpy(szResult, dbv.pszVal, len); szResult[len] = '\0'; mir_free(dbv.pszVal); } @@ -144,7 +144,7 @@ int GetStringFromDatabase(MCONTACT hContact, char *szModule, char *szSettingName { size_t tmp = mir_strlen(szError); len = (tmp < size - 1) ? tmp : size - 1; - strncpy(szResult, szError, len); + mir_strncpy(szResult, szError, len); szResult[len] = '\0'; } else{ @@ -440,7 +440,7 @@ RECT AnchorCalcPos(HWND window, const RECT *rParent, const WINDOWPOS *parentPos, inline char *STRNCPY(char *output, const char *input, size_t size) { - char *res = strncpy(output, input, size); + char *res = mir_strncpy(output, input, size); output[size - 1] = 0; return res; diff --git a/plugins/CrashDumper/src/dumper.cpp b/plugins/CrashDumper/src/dumper.cpp index 8cd63e612a..145478a702 100644 --- a/plugins/CrashDumper/src/dumper.cpp +++ b/plugins/CrashDumper/src/dumper.cpp @@ -86,7 +86,7 @@ BOOL CALLBACK LoadedModulesFind64(LPCSTR ModuleName, DWORD64 ModuleBase, ULONG M if ((DWORD)(data->Offset - ModuleBase) < ModuleSize) { const size_t len = SIZEOF(data->pModule->ModuleName); - strncpy(data->pModule->ModuleName, ModuleName, len); + mir_strncpy(data->pModule->ModuleName, ModuleName, len); data->pModule->ModuleName[len - 1] = 0; data->pModule->BaseOfImage = ModuleBase; diff --git a/plugins/CrashDumper/src/upload.cpp b/plugins/CrashDumper/src/upload.cpp index 7e331f37ce..8554586a42 100644 --- a/plugins/CrashDumper/src/upload.cpp +++ b/plugins/CrashDumper/src/upload.cpp @@ -170,7 +170,7 @@ bool InternetDownloadFile(const char *szUrl, VerTrnsfr* szReq) szRedirUrl = (char*)mir_realloc(szRedirUrl, rlen + mir_strlen(nlhrReply->headers[i].szValue) * 3 + 1); - strncpy(szRedirUrl, szUrl, rlen); + mir_strncpy(szRedirUrl, szUrl, rlen); mir_strcpy(szRedirUrl + rlen, nlhrReply->headers[i].szValue); nlhr.szUrl = szRedirUrl; diff --git a/plugins/DbEditorPP/src/copymodule.cpp b/plugins/DbEditorPP/src/copymodule.cpp index 1e580ba6a4..c58d9b8cae 100644 --- a/plugins/DbEditorPP/src/copymodule.cpp +++ b/plugins/DbEditorPP/src/copymodule.cpp @@ -127,7 +127,7 @@ void copyModuleMenuItem(char* module, MCONTACT hContact) { ModuleAndContact *mac = (ModuleAndContact *)mir_calloc(sizeof(ModuleAndContact)); mac->hContact = hContact; - strncpy(mac->module, module, 255); + mir_strncpy(mac->module, module, 255); CreateDialogParamW(hInst, MAKEINTRESOURCEW(IDD_COPY_MOD), 0, copyModDlgProc, (LPARAM)mac); } \ No newline at end of file diff --git a/plugins/DbEditorPP/src/exportimport.cpp b/plugins/DbEditorPP/src/exportimport.cpp index 9c07ce46b7..99877ae7ce 100644 --- a/plugins/DbEditorPP/src/exportimport.cpp +++ b/plugins/DbEditorPP/src/exportimport.cpp @@ -314,19 +314,19 @@ void importSettings(MCONTACT hContact, char *importstring) p2 = strrchr(&importstring[i], '}*'); if (p1 && p2 && p1 + 3 < p2 && p2 - p1 < SIZEOF(szUID)) { - strncpy(szUID, p1 + 1, p2 - p1 - 2); + mir_strncpy(szUID, p1 + 1, p2 - p1 - 2); p1 = strrchr(&importstring[i], ')*<'); p2 = strrchr(&importstring[i], '>*{'); if (p1 && p2 && p1 + 3 < p2 && p2 - p1 < SIZEOF(uid)) { - strncpy(uid, p1 + 1, p2 - p1 - 3); + mir_strncpy(uid, p1 + 1, p2 - p1 - 3); p1 = strrchr(&importstring[i], ' *('); p2 = strrchr(&importstring[i], ')*<'); if (p1 && p2 && p1 + 3 < p2 && p2 - p1 < SIZEOF(szProto)) { - strncpy(szProto, p1 + 1, p2 - p1 - 3); + mir_strncpy(szProto, p1 + 1, p2 - p1 - 3); char *protouid = (char*)CallProtoService(szProto, PS_GETCAPS, PFLAG_UNIQUEIDSETTING, 0); if ((INT_PTR)protouid != CALLSERVICE_NOTFOUND) { @@ -558,7 +558,7 @@ void ImportSettingsFromFileMenuItem(MCONTACT hContact, char* FilePath) if (!mir_tstrcmp(szFileNames, "") == 0) { if ((DWORD)mir_strlen(szFileNames) < offset) { index += offset; - strncpy(szPath, szFileNames, offset); + mir_strncpy(szPath, szFileNames, offset); mir_strcat(szPath, "\\"); } diff --git a/plugins/DbEditorPP/src/headers.h b/plugins/DbEditorPP/src/headers.h index 425f14ec61..17f729c89b 100644 --- a/plugins/DbEditorPP/src/headers.h +++ b/plugins/DbEditorPP/src/headers.h @@ -76,7 +76,7 @@ extern MCONTACT hRestore; #define WM_FINDITEM (WM_USER + 1) // onyl for the main window, wparam is ItemIfno* lparam is 0 #define mir_strlen(ptr) ((ptr == NULL) ? 0 : (int)mir_strlen(ptr)) -#define mir_strncpy(dst, src, len) strncpy(dst, src, len)[len - 1] = 0; +#define mir_strncpy(dst, src, len) mir_strncpy(dst, src, len)[len - 1] = 0; #define mir_strcmp(ptr1, ptr2) ((ptr1 && ptr2) ? mir_strcmp(ptr1, ptr2) : 1) // (ptr1||ptr2) #define ListView_SetItemTextW(hwndLV, i, iSubItem_, pszText_) \ diff --git a/plugins/DbEditorPP/src/main.cpp b/plugins/DbEditorPP/src/main.cpp index b8b97cec80..25c8a7e647 100644 --- a/plugins/DbEditorPP/src/main.cpp +++ b/plugins/DbEditorPP/src/main.cpp @@ -258,7 +258,7 @@ int DBGetContactSettingStringStatic(MCONTACT hContact, char *szModule, char *szS { DBVARIANT dbv; if (!db_get(hContact, szModule, szSetting, &dbv)) { - strncpy(value, dbv.pszVal, maxLength); + mir_strncpy(value, dbv.pszVal, maxLength); db_free(&dbv); return 1; } @@ -313,7 +313,7 @@ int GetValue(MCONTACT hContact, const char *szModule, const char *szSetting, cha if (Value && length >= 10 && !GetSetting(hContact, szModule, szSetting, &dbv)) { switch (dbv.type) { case DBVT_ASCIIZ: - strncpy(Value, dbv.pszVal, length); + mir_strncpy(Value, dbv.pszVal, length); break; case DBVT_DWORD: _itoa(dbv.dVal, Value, 10); @@ -330,7 +330,7 @@ int GetValue(MCONTACT hContact, const char *szModule, const char *szSetting, cha WCHAR *wc = (WCHAR *)_alloca(len * sizeof(WCHAR)); MultiByteToWideChar(CP_UTF8, 0, dbv.pszVal, -1, wc, len); WideCharToMultiByte(CP_ACP, 0, wc, -1, sz, len, NULL, NULL); - strncpy(Value, sz, length); + mir_strncpy(Value, sz, length); break; } diff --git a/plugins/FloatingContacts/src/filedrop.cpp b/plugins/FloatingContacts/src/filedrop.cpp index f53edeba5b..febfd93610 100644 --- a/plugins/FloatingContacts/src/filedrop.cpp +++ b/plugins/FloatingContacts/src/filedrop.cpp @@ -221,7 +221,7 @@ static int CountFiles( char *szItem ) ( 0 != mir_strcmp( fd.cFileName, ".." )) ) { char szDirName[MAX_PATH]; - strncpy( szDirName, szItem, MAX_PATH - 1); + mir_strncpy( szDirName, szItem, MAX_PATH - 1); if ( NULL != strstr( szItem, "*.*" )) { @@ -263,7 +263,7 @@ static void SaveFiles( char *szItem, char **ppFiles, int *pnCount ) ( 0 != mir_strcmp( fd.cFileName, ".." )) ) { char szDirName[MAX_PATH]; - strncpy( szDirName, szItem, MAX_PATH - 1); + mir_strncpy( szDirName, szItem, MAX_PATH - 1); if ( NULL != strstr( szItem, "*.*" )) { @@ -284,7 +284,7 @@ static void SaveFiles( char *szItem, char **ppFiles, int *pnCount ) size_t nSize = sizeof(char) * ( mir_strlen( szItem ) + mir_strlen( fd.cFileName ) + sizeof( char )); char *szFile = (char*) malloc( nSize ) ; - strncpy( szFile, szItem, nSize - 1); + mir_strncpy( szFile, szItem, nSize - 1); if ( NULL != strstr( szFile, "*.*" )) { diff --git a/plugins/FloatingContacts/src/main.cpp b/plugins/FloatingContacts/src/main.cpp index 8a93846941..9799101748 100644 --- a/plugins/FloatingContacts/src/main.cpp +++ b/plugins/FloatingContacts/src/main.cpp @@ -628,7 +628,7 @@ void RegHotkey(MCONTACT hContact, HWND hwnd) DBVARIANT dbv; if (db_get_s(hContact, MODULE, "Hotkey", &dbv)) return; - strncpy(szBuf, dbv.pszVal, MAX_PATH - 1); + mir_strncpy(szBuf, dbv.pszVal, MAX_PATH - 1); db_free( &dbv ); if (szBuf[0] != '\0') { diff --git a/plugins/Folders/src/services.cpp b/plugins/Folders/src/services.cpp index 4447fdece5..b8ec3c4ae9 100644 --- a/plugins/Folders/src/services.cpp +++ b/plugins/Folders/src/services.cpp @@ -109,7 +109,7 @@ INT_PTR GetPathService(WPARAM wParam, LPARAM lParam) TCHAR buf[MAX_FOLDER_SIZE]; p->Expand(buf, SIZEOF(buf)); - strncpy(data->szPath, _T2A(buf), data->nMaxPathSize); + mir_strncpy(data->szPath, _T2A(buf), data->nMaxPathSize); return 0; } diff --git a/plugins/HTTPServer/src/GuiElements.cpp b/plugins/HTTPServer/src/GuiElements.cpp index b2b67837ee..74775c5f2f 100644 --- a/plugins/HTTPServer/src/GuiElements.cpp +++ b/plugins/HTTPServer/src/GuiElements.cpp @@ -493,7 +493,7 @@ bool bShowShareNewFileDlg(HWND hwndOwner, STFileShareInfo * pstNewShare) { *(end - (start - (pstNewShare->pszSrvPath+1)) ) = '\0'; int realPathLen = szRealDirectoryEnd - pstNewShare->pszRealPath; - strncpy(szRealDirectoryEnd, pstNewShare->pszSrvPath+1, + mir_strncpy(szRealDirectoryEnd, pstNewShare->pszSrvPath+1, pstNewShare->dwMaxRealPath - realPathLen - 1); pstNewShare->pszRealPath[pstNewShare->dwMaxRealPath] = '\0'; @@ -792,7 +792,7 @@ static INT_PTR CALLBACK DlgProcStatsticView(HWND hwndDlg, UINT msg, WPARAM wPara szServPath[0] = '/'; char* fileName = strrchr(szDropedFile, '\\'); if (fileName) - strncpy(&szServPath[1], fileName+1, MAX_PATH-2); + mir_strncpy(&szServPath[1], fileName+1, MAX_PATH-2); if (CallService(MS_HTTP_ADD_CHANGE_REMOVE, 0, (LPARAM)&stNewShare)) { MessageBox(NULL, TranslateT("Failed to share new file"), MSG_BOX_TITEL, MB_OK); @@ -1429,8 +1429,8 @@ void ShowPopupWindow(const char * pszName, const char * pszText, COLORREF ColorB POPUPDATAT *pclData = new POPUPDATAT; memset(pclData, 0, sizeof(POPUPDATAT)); pclData->lchIcon = LoadIcon(hInstance, MAKEINTRESOURCE(IDI_SHARE_NEW_FILE)); - strncpy(pclData->lpzContactName, pszName, sizeof(pclData->lpzContactName) - 1); // -1 so that there aways will be a null termination !! - strncpy(pclData->lpzText, pszText, sizeof(pclData->lpzText) - 1); + mir_strncpy(pclData->lpzContactName, pszName, sizeof(pclData->lpzContactName) - 1); // -1 so that there aways will be a null termination !! + mir_strncpy(pclData->lpzText, pszText, sizeof(pclData->lpzText) - 1); pclData->colorBack = ColorBack; //ppd.colorText = colorText; pclData->PluginWindowProc = PopupWindowProc; diff --git a/plugins/HTTPServer/src/HttpUser.cpp b/plugins/HTTPServer/src/HttpUser.cpp index e1398215bc..4c5604ea07 100644 --- a/plugins/HTTPServer/src/HttpUser.cpp +++ b/plugins/HTTPServer/src/HttpUser.cpp @@ -396,8 +396,8 @@ bool CLHttpUser::bProcessGetRequest(char * pszRequest, bool bIsGetCommand) { char* pszRealPath = pclCur->st.pszRealPath; if (pclCur->bIsDirectory()) { - strncpy(szRealPath, pclCur->st.pszRealPath, MAX_PATH); - strncpy(szSrvPath, pclCur->st.pszSrvPath, MAX_PATH); + mir_strncpy(szRealPath, pclCur->st.pszRealPath, MAX_PATH); + mir_strncpy(szSrvPath, pclCur->st.pszSrvPath, MAX_PATH); pszRealPath = szRealPath; pszSrvPath = szSrvPath; diff --git a/plugins/HTTPServer/src/IndexHTML.cpp b/plugins/HTTPServer/src/IndexHTML.cpp index a2ae11602f..3a0dc74c16 100644 --- a/plugins/HTTPServer/src/IndexHTML.cpp +++ b/plugins/HTTPServer/src/IndexHTML.cpp @@ -62,7 +62,7 @@ bool LoadIndexHTMLTemplate() { char szDestBuf[10000]; char* pszDestBuf = szDestBuf; - strncpy(pszBuf, szPluginPath, SIZEOF(szBuf)-1); + mir_strncpy(pszBuf, szPluginPath, SIZEOF(szBuf)-1); mir_strncat(pszBuf, szIndexHTMLTemplateFile, SIZEOF(szBuf) - mir_strlen(szBuf)); HANDLE hFile = CreateFile(pszBuf, GENERIC_READ, FILE_SHARE_READ | FILE_SHARE_WRITE, @@ -139,7 +139,7 @@ bool LoadIndexHTMLTemplate() { do { if (*pszBuf == ',') { *pszBuf = ':'; - strncpy(pszDestBuf, pszParameterBegin, MAX_PARAM_LENGTH); + mir_strncpy(pszDestBuf, pszParameterBegin, MAX_PARAM_LENGTH); pszDestBuf += MAX_PARAM_LENGTH; pszParameterBegin = pszBuf + 1; @@ -152,7 +152,7 @@ bool LoadIndexHTMLTemplate() { break; *pszBuf = ':'; - strncpy(pszDestBuf, pszParameterBegin, MAX_PARAM_LENGTH); + mir_strncpy(pszDestBuf, pszParameterBegin, MAX_PARAM_LENGTH); pszDestBuf += MAX_PARAM_LENGTH; *pcParamCount = iParamCount; @@ -283,7 +283,7 @@ bool bCreateIndexHTML(const char * pszRealPath, const char * pszIndexPath, // check if directory exists char szMask[MAX_PATH]; - strncpy(szMask, pszRealPath, MAX_PATH- 1); + mir_strncpy(szMask, pszRealPath, MAX_PATH- 1); mir_strncat(szMask, "*", SIZEOF(szMask) - mir_strlen(szMask)); WIN32_FIND_DATAA fdFindFileData; @@ -319,14 +319,14 @@ bool bCreateIndexHTML(const char * pszRealPath, const char * pszIndexPath, bool bEvenOdd = 0; bool bKnownFileType = false; - strncpy(szBuffer, pszSrvPath, SIZEOF(szBuffer)-1); + mir_strncpy(szBuffer, pszSrvPath, SIZEOF(szBuffer)-1); char* pszTemp = strrchr(szBuffer, '/'); if (pszTemp) *pszTemp = '\0'; pszTemp = strrchr(szBuffer, '/'); if (pszTemp) - strncpy(szName, pszTemp + 1, SIZEOF(szName)-1); + mir_strncpy(szName, pszTemp + 1, SIZEOF(szName)-1); if (szName[0] == '\0') mir_strcpy(szName, "my Miranda Webserver"); @@ -470,7 +470,7 @@ bool bCreateIndexHTML(const char * pszRealPath, const char * pszIndexPath, } else { for (byte i = 0; i < iParamCount; i++) { char szParam[MAX_PARAM_LENGTH+1]; - strncpy(szParam, pszParam, MAX_PARAM_LENGTH); + mir_strncpy(szParam, pszParam, MAX_PARAM_LENGTH); szParam[MAX_PARAM_LENGTH] = '\0'; char* pszTmp = strchr(szParam, ':'); if (pszTmp) diff --git a/plugins/HTTPServer/src/IndexXML.cpp b/plugins/HTTPServer/src/IndexXML.cpp index 7de9c2cc8b..d24f76a03e 100644 --- a/plugins/HTTPServer/src/IndexXML.cpp +++ b/plugins/HTTPServer/src/IndexXML.cpp @@ -32,7 +32,7 @@ static void ReplaceSign(char* pszSrc, int MaxLength, const char pszReplace, char* pszSign = strchr(pszSrc, pszReplace); if (pszSign) { - strncpy(szBuffer, pszSrc, SIZEOF(szBuffer)-1); + mir_strncpy(szBuffer, pszSrc, SIZEOF(szBuffer)-1); do { mir_strcpy(szBuffer + (pszSign - pszSrc), pszNew); @@ -41,7 +41,7 @@ static void ReplaceSign(char* pszSrc, int MaxLength, const char pszReplace, } while (pszSign = strchr(pszSrc, pszReplace)); - strncpy(pszSrc, szBuffer, MaxLength); + mir_strncpy(pszSrc, szBuffer, MaxLength); pszSrc[MaxLength-1] = '\0'; } @@ -64,7 +64,7 @@ static void ReplaceSign(char* pszSrc, int MaxLength, const char pszReplace, bool bCreateIndexXML(const char * pszRealPath, const char * pszIndexPath, const char * pszSrvPath, DWORD dwRemoteIP) { char szMask[MAX_PATH+1]; - strncpy(szMask, pszRealPath, MAX_PATH); + mir_strncpy(szMask, pszRealPath, MAX_PATH); mir_strncat(szMask, "*", SIZEOF(szMask) - mir_strlen(szMask)); WIN32_FIND_DATAA fdFindFileData; @@ -89,20 +89,20 @@ bool bCreateIndexXML(const char * pszRealPath, const char * pszIndexPath, DWORD dwBytesWritten = 0; // Generate Dirname - strncpy(szBuffer, pszSrvPath, BUFFER_SIZE); + mir_strncpy(szBuffer, pszSrvPath, BUFFER_SIZE); char* pszTemp = strrchr(szBuffer, '/'); if (pszTemp) *pszTemp = '\0'; pszTemp = strrchr(szBuffer, '/'); if (pszTemp) - strncpy(szFileName, pszTemp + 1, MAX_PATH); + mir_strncpy(szFileName, pszTemp + 1, MAX_PATH); // Write Header WriteFile(hFile, szXmlHeader1, sizeof(szXmlHeader1) - 1, &dwBytesWritten, NULL); // check if a index.xsl exists in the same directory otherwise use the global - strncpy(szMask, pszRealPath, MAX_PATH); + mir_strncpy(szMask, pszRealPath, MAX_PATH); mir_strncat(szMask, "index.xsl", SIZEOF(szMask) - mir_strlen(szMask)); HANDLE hFileExists = CreateFile(szMask, GENERIC_READ, @@ -110,10 +110,10 @@ bool bCreateIndexXML(const char * pszRealPath, const char * pszIndexPath, FILE_ATTRIBUTE_NORMAL, NULL); if (hFileExists == INVALID_HANDLE_VALUE) { - strncpy(szBuffer, "/index.xsl", BUFFER_SIZE); + mir_strncpy(szBuffer, "/index.xsl", BUFFER_SIZE); } else { CloseHandle(hFileExists); - strncpy(szBuffer, "index.xsl", BUFFER_SIZE); + mir_strncpy(szBuffer, "index.xsl", BUFFER_SIZE); } WriteFile(hFile, szBuffer, (DWORD)mir_strlen(szBuffer), &dwBytesWritten, NULL); diff --git a/plugins/IEView/src/ScriverHTMLBuilder.cpp b/plugins/IEView/src/ScriverHTMLBuilder.cpp index 8d9e6aa737..4446898024 100644 --- a/plugins/IEView/src/ScriverHTMLBuilder.cpp +++ b/plugins/IEView/src/ScriverHTMLBuilder.cpp @@ -144,13 +144,13 @@ char *ScriverHTMLBuilder::timestampToString(DWORD dwFlags, time_t check, int mod today = mktime(&tm_today); if (dwFlags & SMF_LOG_USERELATIVEDATE && check >= today) { - strncpy(szResult, Translate("Today"), SIZEOF(szResult)-1); + mir_strncpy(szResult, Translate("Today"), SIZEOF(szResult)-1); if (mode == 0) { mir_strcat(szResult, ","); } } else if (dwFlags & SMF_LOG_USERELATIVEDATE && check > (today - 86400)) { - strncpy(szResult, Translate("Yesterday"), SIZEOF(szResult)-1); + mir_strncpy(szResult, Translate("Yesterday"), SIZEOF(szResult)-1); if (mode == 0) { mir_strcat(szResult, ","); } diff --git a/plugins/ListeningTo/src/listeningto.cpp b/plugins/ListeningTo/src/listeningto.cpp index 6b1c50d224..3c37db3363 100644 --- a/plugins/ListeningTo/src/listeningto.cpp +++ b/plugins/ListeningTo/src/listeningto.cpp @@ -217,7 +217,7 @@ void RegisterProtocol(char *proto, TCHAR *account) size_t id = proto_items.size(); proto_items.resize(id+1); - strncpy(proto_items[id].proto, proto, SIZEOF(proto_items[id].proto)); + mir_strncpy(proto_items[id].proto, proto, SIZEOF(proto_items[id].proto)); proto_items[id].proto[SIZEOF(proto_items[id].proto)-1] = 0; mir_tstrncpy(proto_items[id].account, account, SIZEOF(proto_items[id].account)); diff --git a/plugins/LotusNotify/src/LotusNotify.cpp b/plugins/LotusNotify/src/LotusNotify.cpp index c8683feba1..a7a421f5af 100644 --- a/plugins/LotusNotify/src/LotusNotify.cpp +++ b/plugins/LotusNotify/src/LotusNotify.cpp @@ -118,7 +118,7 @@ STATUS LNPUBLIC __stdcall EMCallBack (EMRECORD * pData) retPassword = VARARG_GET (pArgs, char *); fileName = VARARG_GET (pArgs, char *); ownerName = VARARG_GET (pArgs, char *); - strncpy(retPassword, settingPassword, mir_strlen(settingPassword)); //set our password + mir_strncpy(retPassword, settingPassword, mir_strlen(settingPassword)); //set our password retPassword[mir_strlen(settingPassword)]='\0'; *retLength = (DWORD)mir_strlen(retPassword);//and his length return ERR_BSAFE_EXTERNAL_PASSWORD; @@ -1394,7 +1394,7 @@ INT_PTR GetCaps(WPARAM wParam, LPARAM lParam) //gives name to protocol module INT_PTR GetName(WPARAM wParam, LPARAM lParam) { - strncpy((char*)lParam, PLUGINNAME, wParam); + mir_strncpy((char*)lParam, PLUGINNAME, wParam); return 0; } diff --git a/plugins/MenuItemEx/src/main.cpp b/plugins/MenuItemEx/src/main.cpp index 91631104cf..a98d9f33bf 100644 --- a/plugins/MenuItemEx/src/main.cpp +++ b/plugins/MenuItemEx/src/main.cpp @@ -301,7 +301,7 @@ int StatusMsgExists(MCONTACT hContact) if (statusMsg[i].flag & 8) mir_snprintf(par, SIZEOF(par), "%s/%s", module, statusMsg[i].name); else - strncpy(par, statusMsg[i].name, SIZEOF(par)-1); + mir_strncpy(par, statusMsg[i].name, SIZEOF(par)-1); LPSTR msg = db_get_sa(hContact, (statusMsg[i].module) ? statusMsg[i].module : module, par); if (msg) { @@ -607,7 +607,7 @@ INT_PTR onCopyID(WPARAM wparam, LPARAM lparam) mir_snprintf(buffer, SIZEOF(buffer), "%s: %s", szProto, szID); } else - strncpy(buffer, szID, SIZEOF(buffer)-1); + mir_strncpy(buffer, szID, SIZEOF(buffer)-1); CopyToClipboard((HWND)lparam, buffer, 0); if (CTRL_IS_PRESSED && bPopupService) @@ -632,7 +632,7 @@ INT_PTR onCopyStatusMsg(WPARAM wparam, LPARAM lparam) if (statusMsg[i].flag & 8) mir_snprintf(par, SIZEOF(par), "%s/%s", module, statusMsg[i].name); else - strncpy(par, statusMsg[i].name, SIZEOF(par) - 1); + mir_strncpy(par, statusMsg[i].name, SIZEOF(par) - 1); LPTSTR msg = db_get_tsa(hContact, (statusMsg[i].module) ? statusMsg[i].module : module, par); if (msg) { diff --git a/plugins/MirOTR/src/dbfilter.cpp b/plugins/MirOTR/src/dbfilter.cpp index b3078c0c8d..55ca91add0 100644 --- a/plugins/MirOTR/src/dbfilter.cpp +++ b/plugins/MirOTR/src/dbfilter.cpp @@ -90,7 +90,7 @@ int OnDatabaseEventPreAdd(WPARAM hContact, LPARAM lParam) newmsg = (char*)mir_alloc(alloclen); memset(newmsg, 0, alloclen+datalen); - strncpy(newmsg, options.prefix, prefixlen); + mir_strncpy(newmsg, options.prefix, prefixlen); mir_strncat(newmsg, msg, alloclen - mir_strlen(newmsg)); // append additional data if (datalen) { @@ -129,7 +129,7 @@ int OnDatabaseEventPreAdd(WPARAM hContact, LPARAM lParam) newmsg = (char*)mir_alloc(alloclen+datalen); memset(newmsg, 0, alloclen+datalen); - strncpy(newmsg, prefix, prefixlen); + mir_strncpy(newmsg, prefix, prefixlen); mir_strncat(newmsg, msg, alloclen + datalen - mir_strlen(newmsg)); wchar_t *p = (wchar_t*) newmsg + (msglen + prefixlen + 1); wcsncpy(p, prefixw, prefixlenw); @@ -157,7 +157,7 @@ int OnDatabaseEventPreAdd(WPARAM hContact, LPARAM lParam) newmsg = (char*)mir_alloc(alloclen+datalen); memset(newmsg, 0, alloclen+datalen); - strncpy(newmsg, prefix, prefixlen); + mir_strncpy(newmsg, prefix, prefixlen); mir_strncat(newmsg, msg, msglen - mir_strlen(newmsg)); mir_free(prefix); // append additional data diff --git a/plugins/MirOTR/src/striphtml.cpp b/plugins/MirOTR/src/striphtml.cpp index a7d84b69c4..58f57c0c87 100644 --- a/plugins/MirOTR/src/striphtml.cpp +++ b/plugins/MirOTR/src/striphtml.cpp @@ -9,7 +9,7 @@ void starttag_cb (void *cbdata, ekhtml_string_t *tag, ekhtml_attr_t *attrs) { case 'A': for(ekhtml_attr_t *attr=attrs; attr; attr=attr->next) { if (_strnicmp(attr->name.str, "href", attr->name.len)==0) { - data->stack.push(strncpy((char*)mir_calloc(attr->val.len+1), attr->val.str, attr->val.len)); + data->stack.push(mir_strncpy((char*)mir_calloc(attr->val.len+1), attr->val.str, attr->val.len)); break; } } diff --git a/plugins/NewAwaySysMod/src/CString.h b/plugins/NewAwaySysMod/src/CString.h index b2a1c4accf..12e94ca80a 100644 --- a/plugins/NewAwaySysMod/src/CString.h +++ b/plugins/NewAwaySysMod/src/CString.h @@ -37,7 +37,7 @@ __inline LPCSTR My_strstr(LPCSTR lpString1, LPCSTR lpString2) {return strstr(lpS __inline LPWSTR My_strstr(LPCWSTR lpString1, LPCWSTR lpString2) {return (LPWSTR)wcsstr(lpString1, lpString2);} __inline LPSTR My_lstrcpy(LPSTR lpString1, LPCSTR lpString2) {return mir_strcpy(lpString1, lpString2);} __inline LPWSTR My_lstrcpy(LPWSTR lpString1, LPCWSTR lpString2) {return mir_wstrcpy(lpString1, lpString2);} -__inline LPSTR My_strncpy(LPSTR lpString1, LPCSTR lpString2, int Len) {return strncpy(lpString1, lpString2, Len);} +__inline LPSTR My_strncpy(LPSTR lpString1, LPCSTR lpString2, int Len) {return mir_strncpy(lpString1, lpString2, Len);} __inline LPWSTR My_strncpy(LPWSTR lpString1, LPCWSTR lpString2, int Len) {return wcsncpy(lpString1, lpString2, Len);} __inline LPSTR My_strlwr(LPSTR lpString) {return _strlwr(lpString);} __inline LPWSTR My_strlwr(LPWSTR lpString) {return _wcslwr(lpString);} diff --git a/plugins/New_GPG/src/main.cpp b/plugins/New_GPG/src/main.cpp index 872fa7b141..e282fe17b1 100755 --- a/plugins/New_GPG/src/main.cpp +++ b/plugins/New_GPG/src/main.cpp @@ -2246,8 +2246,8 @@ void InitCheck() ICQ_CUSTOMCAP cap; cap.cbSize = sizeof(ICQ_CUSTOMCAP); cap.hIcon = 0; - strncpy(cap.name, "GPG Key AutoExchange", MAX_CAPNAME); - strncpy(cap.caps, "GPGAutoExchange", sizeof(cap.caps)); + mir_strncpy(cap.name, "GPG Key AutoExchange", MAX_CAPNAME); + mir_strncpy(cap.caps, "GPGAutoExchange", sizeof(cap.caps)); for(int i = 0; i < count; i++) if( ProtoServiceExists(accounts[i]->szProtoName, PS_ICQ_ADDCAPABILITY)) @@ -2261,8 +2261,8 @@ void InitCheck() ICQ_CUSTOMCAP cap; cap.cbSize = sizeof(ICQ_CUSTOMCAP); cap.hIcon = 0; - strncpy(cap.name, "GPG Encrypted FileTransfers", MAX_CAPNAME); - strncpy(cap.caps, "GPGFileTransfer", sizeof(cap.caps)); + mir_strncpy(cap.name, "GPG Encrypted FileTransfers", MAX_CAPNAME); + mir_strncpy(cap.caps, "GPGFileTransfer", sizeof(cap.caps)); for(int i = 0; i < count; i++) if( ProtoServiceExists(accounts[i]->szProtoName, PS_ICQ_ADDCAPABILITY)) diff --git a/plugins/New_GPG/src/messages.cpp b/plugins/New_GPG/src/messages.cpp index 3c6f993507..5cd4560bf6 100755 --- a/plugins/New_GPG/src/messages.cpp +++ b/plugins/New_GPG/src/messages.cpp @@ -538,7 +538,7 @@ INT_PTR RecvMsgSvc(WPARAM w, LPARAM l) if(uin) { if( ProtoServiceExists(proto, PS_ICQ_CHECKCAPABILITY)) { ICQ_CUSTOMCAP cap = {0}; - strncpy(cap.caps, "GPGAutoExchange", sizeof(cap.caps)); + mir_strncpy(cap.caps, "GPGAutoExchange", sizeof(cap.caps)); if(ProtoCallService(proto, PS_ICQ_CHECKCAPABILITY, (WPARAM)ccs->hContact, (LPARAM)&cap)) { CallContactService(ccs->hContact, PSS_MESSAGE, 0, (LPARAM)"-----PGP KEY REQUEST-----"); return 0; @@ -835,7 +835,7 @@ int HookSendMsg(WPARAM w, LPARAM l) if(bDebugLog) debuglog<flags & DBEF_SENT) && db_mc_isMeta((MCONTACT)w)) { char tmp[29]; - strncpy(tmp, (char*)dbei->pBlob, 27); + mir_strncpy(tmp, (char*)dbei->pBlob, 27); tmp[28] = '\0'; if(strstr(tmp, "-----BEGIN PGP MESSAGE-----")) { diff --git a/plugins/New_GPG/src/utilities.cpp b/plugins/New_GPG/src/utilities.cpp index a4d4077ac8..55cc45a1a2 100755 --- a/plugins/New_GPG/src/utilities.cpp +++ b/plugins/New_GPG/src/utilities.cpp @@ -544,7 +544,7 @@ INT_PTR onSendFile(WPARAM w, LPARAM l) if( ProtoServiceExists(proto, PS_ICQ_CHECKCAPABILITY)) { supported_proto = true; ICQ_CUSTOMCAP cap = {0}; - strncpy(cap.caps, "GPGFileTransfer",sizeof(cap.caps)); + mir_strncpy(cap.caps, "GPGFileTransfer",sizeof(cap.caps)); if( ProtoCallService(proto, PS_ICQ_CHECKCAPABILITY, (WPARAM)ccs->hContact, (LPARAM)&cap)) cap_found = true; } diff --git a/plugins/Non-IM Contact/src/namereplacing.cpp b/plugins/Non-IM Contact/src/namereplacing.cpp index 3028cf5f2c..40d6b050fd 100644 --- a/plugins/Non-IM Contact/src/namereplacing.cpp +++ b/plugins/Non-IM Contact/src/namereplacing.cpp @@ -46,8 +46,8 @@ int findWordInString(const char* line, const char* string, int* lengthOfWord, in { unsigned int i, j = 0; char word[64] = "", OpenDivider[8], CloseDivider[8]; - strncpy(OpenDivider, "(\"", sizeof(OpenDivider)); - strncpy(CloseDivider, "\")", sizeof(CloseDivider)); + mir_strncpy(OpenDivider, "(\"", sizeof(OpenDivider)); + mir_strncpy(CloseDivider, "\")", sizeof(CloseDivider)); /* get the word we r looking for */ if (!strncmp(string, OpenDivider, mir_strlen(OpenDivider))) { for (i = 2; strncmp(&string[i], CloseDivider, mir_strlen(CloseDivider)); i++) { @@ -455,8 +455,8 @@ int stringReplacer(const char* oldString, char* newString, MCONTACT hContact) char *fileContents[MAXLINES] = { NULL }, tempString[MAX_STRING_LENGTH]; // setup the variable names - strncpy(newString, "", sizeof(newString)); - strncpy(var_file, "file(", sizeof(var_file)); + mir_strncpy(newString, "", sizeof(newString)); + mir_strncpy(var_file, "file(", sizeof(var_file)); while ((positionInOldString < (int)mir_strlen(oldString)) && (oldString[positionInOldString] != '\0')) { // load the file... must be first diff --git a/plugins/NotesAndReminders/src/options.cpp b/plugins/NotesAndReminders/src/options.cpp index 20ac2bab12..7706a76dcf 100644 --- a/plugins/NotesAndReminders/src/options.cpp +++ b/plugins/NotesAndReminders/src/options.cpp @@ -232,7 +232,7 @@ void RegisterFontServiceFonts() _tcsncpy(fontid.group, _T(SECTIONNAME), SIZEOF(fontid.group)); _tcsncpy(fontid.backgroundGroup, _T(SECTIONNAME), SIZEOF(fontid.backgroundGroup) ); - strncpy(fontid.dbSettingsGroup, MODULENAME, SIZEOF(fontid.dbSettingsGroup)); + mir_strncpy(fontid.dbSettingsGroup, MODULENAME, SIZEOF(fontid.dbSettingsGroup)); fontid.flags = FIDF_ALLOWREREGISTER | FIDF_DEFAULTVALID | FIDF_SAVEPOINTSIZE; HDC hDC = GetDC(NULL); @@ -243,7 +243,7 @@ void RegisterFontServiceFonts() { fontid.order = i; mir_snprintf(szTemp, SIZEOF(szTemp), "Font%d", i); - strncpy(fontid.prefix, szTemp, SIZEOF(fontid.prefix)); + mir_strncpy(fontid.prefix, szTemp, SIZEOF(fontid.prefix)); _tcsncpy(fontid.name, fontOptionsList[i].szDescr, SIZEOF(fontid.name)); fontid.deffontsettings.colour = fontOptionsList[i].defColour; @@ -262,7 +262,7 @@ void RegisterFontServiceFonts() colorid.cbSize = sizeof(ColourIDT); _tcsncpy(colorid.group, _T(SECTIONNAME), SIZEOF(colorid.group)); - strncpy(colorid.dbSettingsGroup, MODULENAME, SIZEOF(fontid.dbSettingsGroup)); + mir_strncpy(colorid.dbSettingsGroup, MODULENAME, SIZEOF(fontid.dbSettingsGroup)); colorid.flags = 0; for (int i = 0; i < SIZEOF(colourOptionsList); i++) @@ -270,7 +270,7 @@ void RegisterFontServiceFonts() colorid.order = i; _tcsncpy(colorid.name, colourOptionsList[i].szName, SIZEOF(colorid.name)); colorid.defcolour = colourOptionsList[i].defColour; - strncpy(colorid.setting, colourOptionsList[i].szSettingName, SIZEOF(colorid.setting)); + mir_strncpy(colorid.setting, colourOptionsList[i].szSettingName, SIZEOF(colorid.setting)); ColourRegisterT(&colorid); } diff --git a/plugins/NotesAndReminders/src/reminders.cpp b/plugins/NotesAndReminders/src/reminders.cpp index 49a8530db7..8af81e76ec 100644 --- a/plugins/NotesAndReminders/src/reminders.cpp +++ b/plugins/NotesAndReminders/src/reminders.cpp @@ -801,7 +801,7 @@ BOOL CheckRemindersAndStart(void) char* S2 = strchr(g_RemindSMS, '@'); char* S1 = (char*)malloc(S2 - g_RemindSMS); - strncpy(S1, g_RemindSMS, S2 - g_RemindSMS); + mir_strncpy(S1, g_RemindSMS, S2 - g_RemindSMS); S1[S2 - g_RemindSMS]= 0x0; S2++; Send(S1, S2, pReminder->Reminder ? pReminder->Reminder : "", NULL); diff --git a/plugins/RemovePersonalSettings/src/rps.cpp b/plugins/RemovePersonalSettings/src/rps.cpp index d15119b7f9..06082185ae 100644 --- a/plugins/RemovePersonalSettings/src/rps.cpp +++ b/plugins/RemovePersonalSettings/src/rps.cpp @@ -553,7 +553,7 @@ void DeleteFileOrFolder(const char *name) WIN32_FIND_DATAA findData; HANDLE hwnd = FindFirstFileA(name, &findData); if (hwnd != INVALID_HANDLE_VALUE) { - strncpy(tmp, name, sizeof(tmp)-1); + mir_strncpy(tmp, name, sizeof(tmp)-1); strTmp = strrchr(tmp,'\\'); if(strTmp != NULL) { diff --git a/plugins/Scriver/src/msgoptions.cpp b/plugins/Scriver/src/msgoptions.cpp index 9bf514bd3d..c854ba09d8 100644 --- a/plugins/Scriver/src/msgoptions.cpp +++ b/plugins/Scriver/src/msgoptions.cpp @@ -108,14 +108,14 @@ void RegisterFontServiceFonts() FontIDT fid = { sizeof(fid) }; _tcsncpy_s(fid.group, LPGENT("Messaging"), _TRUNCATE); _tcsncpy_s(fid.backgroundGroup, LPGENT("Messaging"), _TRUNCATE); - strncpy(fid.dbSettingsGroup, SRMMMOD, SIZEOF(fid.dbSettingsGroup)); + mir_strncpy(fid.dbSettingsGroup, SRMMMOD, SIZEOF(fid.dbSettingsGroup)); fid.flags = FIDF_DEFAULTVALID | FIDF_DEFAULTVALID; for (int i = 0; i < SIZEOF(fontOptionsList); i++) { fid.order = i; char szTemp[100]; mir_snprintf(szTemp, SIZEOF(szTemp), "SRMFont%d", i); - strncpy(fid.prefix, szTemp, SIZEOF(fid.prefix)); + mir_strncpy(fid.prefix, szTemp, SIZEOF(fid.prefix)); _tcsncpy(fid.name, fontOptionsList[i].szDescr, SIZEOF(fid.name)); fid.deffontsettings.colour = fontOptionsList[i].defColour; fid.deffontsettings.size = fontOptionsList[i].defSize; @@ -128,7 +128,7 @@ void RegisterFontServiceFonts() ColourIDT cid = { sizeof(cid) }; _tcsncpy_s(cid.group, LPGENT("Messaging"), _TRUNCATE); - strncpy(cid.dbSettingsGroup, SRMMMOD, SIZEOF(fid.dbSettingsGroup)); + mir_strncpy(cid.dbSettingsGroup, SRMMMOD, SIZEOF(fid.dbSettingsGroup)); cid.flags = 0; for (int i = 0; i < SIZEOF(colourOptionsList); i++) { cid.order = i; @@ -138,7 +138,7 @@ void RegisterFontServiceFonts() else cid.defcolour = colourOptionsList[i].defColour; - strncpy(cid.setting, colourOptionsList[i].szSettingName, SIZEOF(cid.setting)); + mir_strncpy(cid.setting, colourOptionsList[i].szSettingName, SIZEOF(cid.setting)); ColourRegisterT(&cid); } } diff --git a/plugins/SecureIM/src/commonheaders.cpp b/plugins/SecureIM/src/commonheaders.cpp index eca5257814..6a5044482a 100644 --- a/plugins/SecureIM/src/commonheaders.cpp +++ b/plugins/SecureIM/src/commonheaders.cpp @@ -28,7 +28,7 @@ LPSTR myDBGetStringDecode(MCONTACT hContact, const char *szModule, const char *s if (!val) return NULL; size_t len = mir_strlen(val) + 64; char *buf = (LPSTR)mir_alloc(len); - strncpy(buf, val, len); mir_free(val); + mir_strncpy(buf, val, len); mir_free(val); return buf; } @@ -36,7 +36,7 @@ int myDBWriteStringEncode(MCONTACT hContact, const char *szModule, const char *s { int len = (int)mir_strlen(val) + 64; char *buf = (LPSTR)alloca(len); - strncpy(buf, val, len); + mir_strncpy(buf, val, len); int ret = db_set_s(hContact, szModule, szSetting, buf); return ret; } diff --git a/plugins/SecureIM/src/crypt_lists.cpp b/plugins/SecureIM/src/crypt_lists.cpp index 28557fd1af..29db82daed 100644 --- a/plugins/SecureIM/src/crypt_lists.cpp +++ b/plugins/SecureIM/src/crypt_lists.cpp @@ -30,7 +30,7 @@ void loadSupportedProtocols() SupPro *p = (SupPro*)mir_calloc(sizeof(SupPro)); p->name = mir_strdup(protos[i]->szModuleName); if (szNames && p->name) { - char tmp[128]; strncpy(tmp, p->name, sizeof(tmp) - 1); mir_strncat(tmp, ":", SIZEOF(tmp) - mir_strlen(tmp)); + char tmp[128]; mir_strncpy(tmp, p->name, sizeof(tmp) - 1); mir_strncat(tmp, ":", SIZEOF(tmp) - mir_strlen(tmp)); LPSTR szName = strstr(szNames, tmp); if (szName) { szName = strchr(szName, ':'); diff --git a/plugins/SecureIM/src/main.cpp b/plugins/SecureIM/src/main.cpp index 6d3362a52a..a3b37f6819 100644 --- a/plugins/SecureIM/src/main.cpp +++ b/plugins/SecureIM/src/main.cpp @@ -130,11 +130,11 @@ static int onModulesLoaded(WPARAM, LPARAM) else { LPSTR tmp = db_get_sa(0, MODULENAME, "pgpPubRing"); if (tmp) { - strncpy(PubRingPath, tmp, sizeof(PubRingPath)); + mir_strncpy(PubRingPath, tmp, sizeof(PubRingPath)); mir_free(tmp); } if (tmp = db_get_sa(0, MODULENAME, "pgpSecRing")) { - strncpy(SecRingPath, tmp, sizeof(SecRingPath)); + mir_strncpy(SecRingPath, tmp, sizeof(SecRingPath)); mir_free(tmp); } if (PubRingPath[0] && SecRingPath[0]) { @@ -163,11 +163,11 @@ static int onModulesLoaded(WPARAM, LPARAM) LPSTR tmp = db_get_sa(0, MODULENAME, "gpgExec"); if (tmp) { - strncpy(gpgexec, tmp, sizeof(gpgexec)-1); + mir_strncpy(gpgexec, tmp, sizeof(gpgexec)-1); mir_free(tmp); } if (tmp = db_get_sa(0, MODULENAME, "gpgHome")) { - strncpy(gpghome, tmp, sizeof(gpghome)-1); + mir_strncpy(gpghome, tmp, sizeof(gpghome)-1); mir_free(tmp); } diff --git a/plugins/SecureIM/src/options.cpp b/plugins/SecureIM/src/options.cpp index 157ac96f8d..5f95f66817 100644 --- a/plugins/SecureIM/src/options.cpp +++ b/plugins/SecureIM/src/options.cpp @@ -1400,14 +1400,14 @@ void setListViewIcon(HWND hLV, UINT iItem, pUinKey ptr) void setListViewMode(HWND hLV, UINT iItem, UINT iMode) { char tmp[256]; - strncpy(tmp, Translate(sim231[iMode]), sizeof(tmp)-1); + mir_strncpy(tmp, Translate(sim231[iMode]), sizeof(tmp)-1); LV_SetItemTextA(hLV, iItem, 2, tmp); } void setListViewStatus(HWND hLV, UINT iItem, UINT iStatus) { char tmp[128]; - strncpy(tmp, Translate(sim232[iStatus]), sizeof(tmp)-1); + mir_strncpy(tmp, Translate(sim232[iStatus]), sizeof(tmp)-1); LV_SetItemTextA(hLV, iItem, 3, tmp); } @@ -1421,7 +1421,7 @@ UINT getListViewPSK(HWND hLV, UINT iItem) void setListViewPSK(HWND hLV, UINT iItem, UINT iStatus) { char str[128]; - strncpy(str, (iStatus) ? Translate(sim206) : "-", sizeof(str)-1); + mir_strncpy(str, (iStatus) ? Translate(sim206) : "-", sizeof(str)-1); LV_SetItemTextA(hLV, iItem, 4, str); } @@ -1435,7 +1435,7 @@ UINT getListViewPUB(HWND hLV, UINT iItem) void setListViewPUB(HWND hLV, UINT iItem, UINT iStatus) { char str[128]; - strncpy(str, (iStatus) ? Translate(sim233) : "-", sizeof(str)-1); + mir_strncpy(str, (iStatus) ? Translate(sim233) : "-", sizeof(str)-1); LV_SetItemTextA(hLV, iItem, 4, str); LPSTR sha = NULL; diff --git a/plugins/SecureIM/src/svcs_proto.cpp b/plugins/SecureIM/src/svcs_proto.cpp index e254f7b81e..bdfe43dfcd 100644 --- a/plugins/SecureIM/src/svcs_proto.cpp +++ b/plugins/SecureIM/src/svcs_proto.cpp @@ -865,7 +865,7 @@ int __cdecl onProtoAck(WPARAM wParam, LPARAM lParam) LPSTR p = strrchr(file_out, '.'); LPSTR x = strrchr(file_out, '\\'); if (p > x) { - strncpy(buf, p, sizeof(buf)-1); + mir_strncpy(buf, p, sizeof(buf)-1); pos = p; } for (int i = 1; i < 10000; i++) { diff --git a/plugins/SeenPlugin/src/utils.cpp b/plugins/SeenPlugin/src/utils.cpp index ce2391d99e..c8421bf359 100644 --- a/plugins/SeenPlugin/src/utils.cpp +++ b/plugins/SeenPlugin/src/utils.cpp @@ -642,7 +642,7 @@ int UpdateValues(WPARAM hContact, LPARAM lparam) if (p == NULL) { p = (logthread_info*)mir_calloc(sizeof(logthread_info)); p->hContact = hContact; - strncpy(p->sProtoName, cws->szModule, MAXMODULELABELLENGTH); + mir_strncpy(p->sProtoName, cws->szModule, MAXMODULELABELLENGTH); arContacts.insert(p); mir_forkthread(waitThread, p); } @@ -697,7 +697,7 @@ int ModeChange(WPARAM wparam, LPARAM lparam) db_set_dw(NULL, "UserOnline", ack->szModule, GetTickCount()); if (!Miranda_Terminated() && IsWatchedProtocol(ack->szModule)) { logthread_info *info = (logthread_info *)malloc(sizeof(logthread_info)); - strncpy(info->sProtoName, courProtoName, MAXMODULELABELLENGTH); + mir_strncpy(info->sProtoName, courProtoName, MAXMODULELABELLENGTH); info->hContact = 0; info->currStatus = 0; diff --git a/plugins/Sessions/Src/Utils.cpp b/plugins/Sessions/Src/Utils.cpp index 87afd484ab..11b40bf93c 100644 --- a/plugins/Sessions/Src/Utils.cpp +++ b/plugins/Sessions/Src/Utils.cpp @@ -137,7 +137,7 @@ void AddInSessionOrder(MCONTACT hContact, int mode, int ordernum, int writemode) len = 20; char *temp2 = (char*)_alloca(len - 1); - strncpy(temp2, szValue, len - 2); + mir_strncpy(temp2, szValue, len - 2); temp2[len - 2] = '\0'; char *temp = (char*)_alloca(len + 1); diff --git a/plugins/SimpleStatusMsg/src/main.cpp b/plugins/SimpleStatusMsg/src/main.cpp index 9162be6f97..7ad7daf798 100644 --- a/plugins/SimpleStatusMsg/src/main.cpp +++ b/plugins/SimpleStatusMsg/src/main.cpp @@ -69,13 +69,13 @@ void log2file(const char *fmt, ...) HANDLE hFile = CreateFileA("simplestatusmsg.log", GENERIC_WRITE, FILE_SHARE_READ, 0, OPEN_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL); SetFilePointer(hFile, 0, 0, FILE_END); - strncpy(szText, "[\0", SIZEOF(szText)); + mir_strncpy(szText, "[\0", SIZEOF(szText)); WriteFile(hFile, szText, (DWORD)mir_strlen(szText), &dwBytesWritten, NULL); GetTimeFormatA(LOCALE_USER_DEFAULT, 0, NULL, NULL, szText, SIZEOF(szText)); WriteFile(hFile, szText, (DWORD)mir_strlen(szText), &dwBytesWritten, NULL); - strncpy(szText, "] \0", SIZEOF(szText)); + mir_strncpy(szText, "] \0", SIZEOF(szText)); va_start(va, fmt); mir_vsnprintf(szText + mir_strlen(szText), SIZEOF(szText) - mir_strlen(szText), fmt, va); @@ -83,7 +83,7 @@ void log2file(const char *fmt, ...) WriteFile(hFile, szText, (DWORD)mir_strlen(szText), &dwBytesWritten, NULL); - strncpy(szText, "\n\0", SIZEOF(szText)); + mir_strncpy(szText, "\n\0", SIZEOF(szText)); WriteFile(hFile, szText, (DWORD)mir_strlen(szText), &dwBytesWritten, NULL); CloseHandle(hFile); diff --git a/plugins/SmileyAdd/src/dlgboxsubclass.cpp b/plugins/SmileyAdd/src/dlgboxsubclass.cpp index fb3ecbb303..6b0179125e 100644 --- a/plugins/SmileyAdd/src/dlgboxsubclass.cpp +++ b/plugins/SmileyAdd/src/dlgboxsubclass.cpp @@ -305,7 +305,7 @@ static void MsgWndDetect(HWND hwndDlg, MCONTACT hContact, msgData* datm) // Get the protocol for this contact to display correct smileys. char *protonam = GetContactProto(DecodeMetaContact(dat.hContact)); if (protonam) { - strncpy(dat.ProtocolName, protonam, sizeof(dat.ProtocolName)); + mir_strncpy(dat.ProtocolName, protonam, sizeof(dat.ProtocolName)); dat.ProtocolName[sizeof(dat.ProtocolName)-1] = 0; } diff --git a/plugins/SmileyAdd/src/download.cpp b/plugins/SmileyAdd/src/download.cpp index 338b84d279..46138ce186 100644 --- a/plugins/SmileyAdd/src/download.cpp +++ b/plugins/SmileyAdd/src/download.cpp @@ -98,7 +98,7 @@ bool InternetDownloadFile(const char *szUrl, char* szDest, HANDLE &hHttpDwnl) szRedirUrl = (char*)mir_realloc(szRedirUrl, rlen + mir_strlen(nlhrReply->headers[i].szValue)*3 + 1); - strncpy(szRedirUrl, szUrl, rlen); + mir_strncpy(szRedirUrl, szUrl, rlen); mir_strcpy(szRedirUrl+rlen, nlhrReply->headers[i].szValue); nlhr.szUrl = szRedirUrl; diff --git a/plugins/SpellChecker/src/utils.cpp b/plugins/SpellChecker/src/utils.cpp index ba907461ab..8c1f901f5d 100644 --- a/plugins/SpellChecker/src/utils.cpp +++ b/plugins/SpellChecker/src/utils.cpp @@ -908,7 +908,7 @@ int AddContactTextBox(MCONTACT hContact, HWND hwnd, char *name, BOOL srmm, HWND dlg->hContact = hContact; dlg->hwnd = hwnd; - strncpy(dlg->name, name, sizeof(dlg->name)); + mir_strncpy(dlg->name, name, sizeof(dlg->name)); dlg->enabled = db_get_b(dlg->hContact, MODULE_NAME, dlg->name, 1); dlg->srmm = srmm; diff --git a/plugins/StatusPlugins/KeepStatus/keepstatus.cpp b/plugins/StatusPlugins/KeepStatus/keepstatus.cpp index 668b2cceea..2242d866f9 100644 --- a/plugins/StatusPlugins/KeepStatus/keepstatus.cpp +++ b/plugins/StatusPlugins/KeepStatus/keepstatus.cpp @@ -802,7 +802,7 @@ static void CheckContinueslyFunction(void *) while ((*end != ' ') && (*end != '\0')) end++; memset(host, '\0', sizeof(host)); - strncpy(host, start, end - start); + mir_strncpy(host, start, end - start); hostent = gethostbyname(host); if (hostent != NULL) { addr = (DWORD *)(*hostent->h_addr_list); diff --git a/plugins/TabSRMM/src/chat/options.cpp b/plugins/TabSRMM/src/chat/options.cpp index 5becbc5910..38df7808a1 100644 --- a/plugins/TabSRMM/src/chat/options.cpp +++ b/plugins/TabSRMM/src/chat/options.cpp @@ -494,13 +494,13 @@ void RegisterFontServiceFonts() fid.cbSize = sizeof(FontIDT); cid.cbSize = sizeof(ColourIDT); - strncpy(fid.dbSettingsGroup, FONTMODULE, SIZEOF(fid.dbSettingsGroup)); + mir_strncpy(fid.dbSettingsGroup, FONTMODULE, SIZEOF(fid.dbSettingsGroup)); for (int i = 0; i < SIZEOF(IM_fontOptionsList); i++) { fid.flags = FIDF_DEFAULTVALID | FIDF_ALLOWEFFECTS; LoadMsgDlgFont(FONTSECTION_IM, i, &lf, &fontOptionsList[i].colour, FONTMODULE); mir_snprintf(szTemp, SIZEOF(szTemp), "Font%d", i); - strncpy(fid.prefix, szTemp, SIZEOF(fid.prefix)); + mir_strncpy(fid.prefix, szTemp, SIZEOF(fid.prefix)); fid.order = i; _tcsncpy(fid.name, fontOptionsList[i].szDescr, SIZEOF(fid.name)); fid.deffontsettings.colour = fontOptionsList[i].colour; @@ -563,7 +563,7 @@ void RegisterFontServiceFonts() for (int i = 0; i < IPFONTCOUNT; i++) { LoadMsgDlgFont(FONTSECTION_IP, i + 100, &lf, &fontOptionsList[i].colour, FONTMODULE); mir_snprintf(szTemp, SIZEOF(szTemp), "Font%d", i + 100); - strncpy(fid.prefix, szTemp, SIZEOF(fid.prefix)); + mir_strncpy(fid.prefix, szTemp, SIZEOF(fid.prefix)); fid.order = i + 100; _tcsncpy(fid.name, fontOptionsList[i].szDescr, SIZEOF(fid.name)); fid.deffontsettings.colour = fontOptionsList[i].colour; @@ -582,12 +582,12 @@ void RegisterFontServiceFonts() } _tcsncpy(cid.group, LPGENT("Message Sessions")_T("/")LPGENT("Group chats"), SIZEOF(cid.group)); - strncpy(cid.dbSettingsGroup, CHAT_MODULE, SIZEOF(cid.dbSettingsGroup)); + mir_strncpy(cid.dbSettingsGroup, CHAT_MODULE, SIZEOF(cid.dbSettingsGroup)); for (int i = 0; i <= 7; i++) { mir_snprintf(szTemp, SIZEOF(szTemp), "NickColor%d", i); _tcsncpy(cid.name, chatcolorsnames[i], SIZEOF(cid.name)); cid.order = i + 1; - strncpy(cid.setting, szTemp, SIZEOF(cid.setting)); + mir_strncpy(cid.setting, szTemp, SIZEOF(cid.setting)); switch (i) { case 5: cid.defcolour = GetSysColor(COLOR_HIGHLIGHT); @@ -613,14 +613,14 @@ void RegisterFontServiceFonts() ColourRegisterT(&cid); // static colors (info panel, tool bar background etc...) - strncpy(fid.dbSettingsGroup, FONTMODULE, SIZEOF(fid.dbSettingsGroup)); - strncpy(cid.dbSettingsGroup, FONTMODULE, SIZEOF(fid.dbSettingsGroup)); + mir_strncpy(fid.dbSettingsGroup, FONTMODULE, SIZEOF(fid.dbSettingsGroup)); + mir_strncpy(cid.dbSettingsGroup, FONTMODULE, SIZEOF(fid.dbSettingsGroup)); for (int i = 0; i < SIZEOF(_clrs); i++) { cid.order = _clrs[i].order; _tcsncpy(cid.group, _clrs[i].tszGroup, SIZEOF(fid.group)); _tcsncpy(cid.name, _clrs[i].tszName, SIZEOF(cid.name)); - strncpy(cid.setting, _clrs[i].szSetting, SIZEOF(cid.setting)); + mir_strncpy(cid.setting, _clrs[i].szSetting, SIZEOF(cid.setting)); if (_clrs[i].def & 0xff000000) cid.defcolour = GetSysColor(_clrs[i].def & 0x000000ff); else @@ -628,14 +628,14 @@ void RegisterFontServiceFonts() ColourRegisterT(&cid); } - strncpy(cid.dbSettingsGroup, SRMSGMOD_T, SIZEOF(fid.dbSettingsGroup)); + mir_strncpy(cid.dbSettingsGroup, SRMSGMOD_T, SIZEOF(fid.dbSettingsGroup)); // text and background colors for tabs for (int i = 0; i < SIZEOF(_tabclrs); i++) { cid.order = _tabclrs[i].order; _tcsncpy(cid.group, _tabclrs[i].tszGroup, SIZEOF(fid.group)); _tcsncpy(cid.name, _tabclrs[i].tszName, SIZEOF(cid.name)); - strncpy(cid.setting, _tabclrs[i].szSetting, SIZEOF(cid.setting)); + mir_strncpy(cid.setting, _tabclrs[i].szSetting, SIZEOF(cid.setting)); if (_tabclrs[i].def & 0xff000000) cid.defcolour = GetSysColor(_tabclrs[i].def & 0x000000ff); else diff --git a/plugins/TabSRMM/src/generic_msghandlers.cpp b/plugins/TabSRMM/src/generic_msghandlers.cpp index 16cf2b8b38..be469c5842 100644 --- a/plugins/TabSRMM/src/generic_msghandlers.cpp +++ b/plugins/TabSRMM/src/generic_msghandlers.cpp @@ -813,7 +813,7 @@ void TSAPI DM_InitRichEdit(TWindowData *dat) cf2.crTextColor = inputcharcolor; cf2.bCharSet = lf.lfCharSet; cf2.crBackColor = dat->inputbg; - strncpy(cf2.szFaceName, lf.lfFaceName, LF_FACESIZE); + mir_strncpy(cf2.szFaceName, lf.lfFaceName, LF_FACESIZE); cf2.dwEffects = 0; cf2.wWeight = (WORD)lf.lfWeight; cf2.bPitchAndFamily = lf.lfPitchAndFamily; @@ -830,7 +830,7 @@ void TSAPI DM_InitRichEdit(TWindowData *dat) cf2.dwMask = CFM_COLOR | CFM_FACE | CFM_CHARSET | CFM_SIZE | CFM_WEIGHT | CFM_BOLD | CFM_ITALIC; cf2.crTextColor = inputcharcolor; cf2.bCharSet = lf.lfCharSet; - strncpy(cf2.szFaceName, lf.lfFaceName, LF_FACESIZE-1); + mir_strncpy(cf2.szFaceName, lf.lfFaceName, LF_FACESIZE-1); cf2.dwEffects = ((lf.lfWeight >= FW_BOLD) ? CFE_BOLD : 0) | (lf.lfItalic ? CFE_ITALIC : 0) | (lf.lfUnderline ? CFE_UNDERLINE : 0) | (lf.lfStrikeOut ? CFE_STRIKEOUT : 0); cf2.wWeight = (WORD)lf.lfWeight; cf2.bPitchAndFamily = lf.lfPitchAndFamily; diff --git a/plugins/TabSRMM/src/sendlater.cpp b/plugins/TabSRMM/src/sendlater.cpp index bcc649242e..0cb77c3e32 100644 --- a/plugins/TabSRMM/src/sendlater.cpp +++ b/plugins/TabSRMM/src/sendlater.cpp @@ -325,14 +325,14 @@ int CSendLater::addJob(const char *szSetting, LPARAM lParam) CSendLaterJob *job = new CSendLaterJob; - strncpy(job->szId, szSetting, 20); + mir_strncpy(job->szId, szSetting, 20); job->szId[19] = 0; job->hContact = hContact; job->created = atol(&szSetting[1]); size_t iLen = mir_strlen(szOrig_Utf); job->sendBuffer = reinterpret_cast(mir_alloc(iLen + 1)); - strncpy(job->sendBuffer, szOrig_Utf, iLen); + mir_strncpy(job->sendBuffer, szOrig_Utf, iLen); job->sendBuffer[iLen] = 0; // construct conventional send buffer @@ -345,7 +345,7 @@ int CSendLater::addJob(const char *szSetting, LPARAM lParam) job->pBuf = (PBYTE)mir_calloc(required); - strncpy((char*)job->pBuf, szAnsi, iLen); + mir_strncpy((char*)job->pBuf, szAnsi, iLen); job->pBuf[iLen] = 0; if (szWchar) wcsncpy((wchar_t*)&job->pBuf[iLen + 1], szWchar, mir_wstrlen(szWchar)); diff --git a/plugins/TabSRMM/src/themes.cpp b/plugins/TabSRMM/src/themes.cpp index a0825801b6..46280b0072 100644 --- a/plugins/TabSRMM/src/themes.cpp +++ b/plugins/TabSRMM/src/themes.cpp @@ -817,7 +817,7 @@ TCHAR* CImageItem::Read(const TCHAR *szFilename) GetPrivateProfileString(m_szName, _T("Image"), _T("None"), buffer, 500, szFilename); if (mir_tstrcmp(buffer, _T("None")) || m_dwFlags & IMAGE_GLYPH) { szFinalName = new TCHAR[MAX_PATH]; - //strncpy(m_szName, &m_szName[1], sizeof(m_szName)); + //mir_strncpy(m_szName, &m_szName[1], sizeof(m_szName)); //m_szName[sizeof(m_szName) - 1] = 0; _tsplitpath(szFilename, szDrive, szPath, NULL, NULL); mir_sntprintf(szFinalName, MAX_PATH, _T("%s\\%s%s"), szDrive, szPath, buffer); diff --git a/plugins/TipperYM/src/mir_smileys.cpp b/plugins/TipperYM/src/mir_smileys.cpp index a6ac7e8cd9..6fd7cbf805 100644 --- a/plugins/TipperYM/src/mir_smileys.cpp +++ b/plugins/TipperYM/src/mir_smileys.cpp @@ -314,11 +314,11 @@ SortedList *ReplaceSmileys(const TCHAR *text, int text_size, const char *protoco char smileyProto[64]; if (protocol == NULL) - strncpy(smileyProto, "tipper", sizeof(smileyProto) - 1); + mir_strncpy(smileyProto, "tipper", sizeof(smileyProto) - 1); else if (mir_strcmp(protocol, META_PROTO) == 0) - strncpy(smileyProto, "tipper", sizeof(smileyProto) - 1); + mir_strncpy(smileyProto, "tipper", sizeof(smileyProto) - 1); else - strncpy(smileyProto, protocol, sizeof(smileyProto) - 1); + mir_strncpy(smileyProto, protocol, sizeof(smileyProto) - 1); // Parse it! SMADD_BATCHPARSE2 sp = { 0 }; diff --git a/plugins/TipperYM/src/options.cpp b/plugins/TipperYM/src/options.cpp index 85ca77b699..14d46e1855 100644 --- a/plugins/TipperYM/src/options.cpp +++ b/plugins/TipperYM/src/options.cpp @@ -69,7 +69,7 @@ void CreateDefaultItems() DSListNode *ds_node = (DSListNode *)mir_alloc(sizeof(DSListNode)); _tcsncpy(ds_node->ds.swzName, subst->swzName, LABEL_LEN); ds_node->ds.type = subst->type; - strncpy(ds_node->ds.szSettingName, subst->szSettingName, SETTING_NAME_LEN); + mir_strncpy(ds_node->ds.szSettingName, subst->szSettingName, SETTING_NAME_LEN); ds_node->ds.iTranslateFuncId = subst->iTranslateFuncId; ds_node->next = opt.dsList; opt.dsList = ds_node; @@ -110,7 +110,7 @@ bool LoadDS(DISPLAYSUBST *ds, int index) mir_snprintf(setting, SIZEOF(setting), "Module%d", index); ds->szModuleName[0] = 0; if (!db_get(0, MODULE_ITEMS, setting, &dbv)) { - strncpy(ds->szModuleName, dbv.pszVal, MODULE_NAME_LEN); + mir_strncpy(ds->szModuleName, dbv.pszVal, MODULE_NAME_LEN); ds->szModuleName[MODULE_NAME_LEN - 1] = 0; db_free(&dbv); } @@ -118,7 +118,7 @@ bool LoadDS(DISPLAYSUBST *ds, int index) mir_snprintf(setting, SIZEOF(setting), "Setting%d", index); ds->szSettingName[0] = 0; if (!db_get(0, MODULE_ITEMS, setting, &dbv)) { - strncpy(ds->szSettingName, dbv.pszVal, SETTING_NAME_LEN); + mir_strncpy(ds->szSettingName, dbv.pszVal, SETTING_NAME_LEN); ds->szSettingName[SETTING_NAME_LEN - 1] = 0; db_free(&dbv); } @@ -910,10 +910,10 @@ INT_PTR CALLBACK DlgProcOptsContent(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA _tcsncpy(ds_value->ds.swzName, subst->swzName, LABEL_LEN - 1); if (ds_value->ds.type == DVT_DB && subst->szModuleName) - strncpy(ds_value->ds.szModuleName, subst->szModuleName, MODULE_NAME_LEN - 1); + mir_strncpy(ds_value->ds.szModuleName, subst->szModuleName, MODULE_NAME_LEN - 1); if (subst->szSettingName) - strncpy(ds_value->ds.szSettingName, subst->szSettingName, SETTING_NAME_LEN - 1); + mir_strncpy(ds_value->ds.szSettingName, subst->szSettingName, SETTING_NAME_LEN - 1); ds_value->ds.iTranslateFuncId = subst->iTranslateFuncId; diff --git a/plugins/TipperYM/src/popwin.cpp b/plugins/TipperYM/src/popwin.cpp index 1396836639..11fa12f1e5 100644 --- a/plugins/TipperYM/src/popwin.cpp +++ b/plugins/TipperYM/src/popwin.cpp @@ -338,9 +338,9 @@ LRESULT CALLBACK PopupWindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lPa if (iXstatus) { char szIconProto[64]; if (mir_strcmp(szProto, META_PROTO) != 0) - strncpy(szIconProto, szProto, sizeof(szIconProto) - 1); + mir_strncpy(szIconProto, szProto, sizeof(szIconProto) - 1); else if (!db_get_s(pwd->hContact, szProto, "XStatusProto", &dbv)) { - strncpy(szIconProto, dbv.pszVal, sizeof(szIconProto) - 1); + mir_strncpy(szIconProto, dbv.pszVal, sizeof(szIconProto) - 1); db_free(&dbv); } diff --git a/plugins/TooltipNotify/src/TooltipNotify.cpp b/plugins/TooltipNotify/src/TooltipNotify.cpp index e1ab66d706..ffd7b749ce 100644 --- a/plugins/TooltipNotify/src/TooltipNotify.cpp +++ b/plugins/TooltipNotify/src/TooltipNotify.cpp @@ -74,7 +74,7 @@ void CTooltipNotify::RegisterFonts() { FontIDT fontId = { sizeof(fontId) }; _tcsncpy(fontId.group, FONTSERV_GROUP, SIZEOF(fontId.group)-1); - strncpy(fontId.dbSettingsGroup, MODULENAME, SIZEOF(fontId.dbSettingsGroup)-1); + mir_strncpy(fontId.dbSettingsGroup, MODULENAME, SIZEOF(fontId.dbSettingsGroup)-1); fontId.flags = FIDF_DEFAULTVALID; fontId.deffontsettings.colour = DEF_SETTING_TXTCOLOR; fontId.deffontsettings.size = -MulDiv(DEF_SETTING_FONT_SIZE, DEF_LOGPIXELSY, 72); @@ -86,19 +86,19 @@ void CTooltipNotify::RegisterFonts() ColourIDT colorId = { sizeof(colorId) }; _tcsncpy(colorId.group, FONTSERV_GROUP, SIZEOF(colorId.group)-1); - strncpy(colorId.dbSettingsGroup, MODULENAME, SIZEOF(colorId.dbSettingsGroup)-1); + mir_strncpy(colorId.dbSettingsGroup, MODULENAME, SIZEOF(colorId.dbSettingsGroup)-1); colorId.flags = 0; colorId.defcolour = DEF_SETTING_BGCOLOR; colorId.order = 0; for (int i=0; i static void __bcopy(char *dest, const char *orig, size_t len) { - strncpy(dest, orig, len); + mir_strncpy(dest, orig, len); } template<> diff --git a/plugins/Variables/src/parse_inet.cpp b/plugins/Variables/src/parse_inet.cpp index c1c6f405ac..d0f128d731 100644 --- a/plugins/Variables/src/parse_inet.cpp +++ b/plugins/Variables/src/parse_inet.cpp @@ -41,7 +41,7 @@ static TCHAR *parseUrlEnc(ARGUMENTSINFO *ai) char hex[8]; memmove(res + cur + 3, res + cur + 1, mir_strlen(res + cur + 1) + 1); mir_snprintf(hex, SIZEOF(hex), "%%%x", *(res + cur)); - strncpy(res + cur, hex, mir_strlen(hex)); + mir_strncpy(res + cur, hex, mir_strlen(hex)); cur += mir_strlen(hex); } @@ -64,7 +64,7 @@ static TCHAR *parseUrlDec(ARGUMENTSINFO *ai) if ((*(res + cur) == '%') && (mir_strlen(res + cur) >= 3)) { char hex[8]; memset(hex, '\0', sizeof(hex)); - strncpy(hex, res + cur + 1, 2); + mir_strncpy(hex, res + cur + 1, 2); *(res + cur) = (char)strtol(hex, NULL, 16); memmove(res + cur + 1, res + cur + 3, mir_strlen(res + cur + 3) + 1); } diff --git a/plugins/Weather/src/weather_ini.cpp b/plugins/Weather/src/weather_ini.cpp index 9e636102dd..d28e24549e 100644 --- a/plugins/Weather/src/weather_ini.cpp +++ b/plugins/Weather/src/weather_ini.cpp @@ -351,7 +351,7 @@ void LoadStationData(TCHAR *pszFile, TCHAR *pszShortFile, WIDATA *Data) if (Line[1] != '/') { // if it is not a footer (for old ini) // save the group name Temp = (char *)mir_alloc(mir_strlen(Line)+10); - strncpy(Temp, Line+1, chop-Line-1); + mir_strncpy(Temp, Line+1, chop-Line-1); Temp[chop-Line-1] = 0; wfree(&Group); wSetData(&Group, Temp); @@ -381,7 +381,7 @@ void LoadStationData(TCHAR *pszFile, TCHAR *pszShortFile, WIDATA *Data) // get the string before '=' (ValName) and after '=' (Value) ValName = (char *)mir_alloc(mir_strlen(Line)+1); - strncpy(ValName, Line, Value-Line); + mir_strncpy(ValName, Line, Value-Line); ValName[Value-Line] = 0; Value++; ConvertBackslashes(Value); diff --git a/plugins/Weather/src/weather_svcs.cpp b/plugins/Weather/src/weather_svcs.cpp index b485257601..73bd25a76b 100644 --- a/plugins/Weather/src/weather_svcs.cpp +++ b/plugins/Weather/src/weather_svcs.cpp @@ -90,7 +90,7 @@ INT_PTR WeatherGetCaps(WPARAM wParam, LPARAM lParam) // protocol service function to get weather protocol name INT_PTR WeatherGetName(WPARAM wParam,LPARAM lParam) { - strncpy((char*)lParam,WEATHERPROTOTEXT,wParam-1); + mir_strncpy((char*)lParam,WEATHERPROTOTEXT,wParam-1); *((char*)lParam + wParam-1) = 0; return 0; } diff --git a/plugins/WebView/src/webview_alerts.cpp b/plugins/WebView/src/webview_alerts.cpp index feffb27c1f..ed6169c3d9 100644 --- a/plugins/WebView/src/webview_alerts.cpp +++ b/plugins/WebView/src/webview_alerts.cpp @@ -272,7 +272,7 @@ int ProcessAlerts(MCONTACT hContact, char *truncated, char *tstr, char *contactn memset(&tempraw, 0, sizeof(tempraw)); memset(&raw, 0, sizeof(raw)); - strncpy(tempraw, truncated, SIZEOF(tempraw)); + mir_strncpy(tempraw, truncated, SIZEOF(tempraw)); memset(&alertstring, 0, sizeof(alertstring)); memset(&Alerttempstring, 0, sizeof(Alerttempstring)); @@ -562,7 +562,7 @@ int ProcessAlerts(MCONTACT hContact, char *truncated, char *tstr, char *contactn disalertpos = 0; //write selected data to string - strncpy(raw, &tempraw[statalertpos], (statalertposend - statalertpos)); + mir_strncpy(raw, &tempraw[statalertpos], (statalertposend - statalertpos)); raw[(statalertposend - statalertpos)] = '\0'; } } // end putting data into string @@ -760,7 +760,7 @@ int ProcessAlerts(MCONTACT hContact, char *truncated, char *tstr, char *contactn } } } - strncpy(truncated, tempraw, mir_strlen(truncated)); + mir_strncpy(truncated, tempraw, mir_strlen(truncated)); return wasAlert; } diff --git a/plugins/WebView/src/webview_cleanup.cpp b/plugins/WebView/src/webview_cleanup.cpp index 67a4ee5a1d..b645cb5e5d 100644 --- a/plugins/WebView/src/webview_cleanup.cpp +++ b/plugins/WebView/src/webview_cleanup.cpp @@ -386,7 +386,7 @@ void CodetoSymbol(char *truncated) } truncated[(position + counter) - 1] = Characters[n]; - strncpy(&truncated[position], &truncated[position + mir_strlen(CharacterCodes[n])] - 1, mir_strlen(&truncated[position]) - 1); + mir_strncpy(&truncated[position], &truncated[position + mir_strlen(CharacterCodes[n])] - 1, mir_strlen(&truncated[position]) - 1); } // end does character code exist? if (recpos == position) @@ -407,7 +407,7 @@ void EraseBlock(char *truncated) char* tempraw = (char*)malloc(MAXSIZE1); if (truncated) - strncpy(tempraw, truncated, MAXSIZE1); + mir_strncpy(tempraw, truncated, MAXSIZE1); // /////////////////////////// @@ -584,7 +584,7 @@ void EraseBlock(char *truncated) positionStart = 0; positionEnd = 0; - strncpy(truncated, tempraw, mir_strlen(truncated)); + mir_strncpy(truncated, tempraw, mir_strlen(truncated)); free(tempraw); } @@ -597,7 +597,7 @@ void EraseSymbols(char *truncated) char *tempraw = (char*)malloc(MAXSIZE1); if (truncated) - strncpy(tempraw, truncated, MAXSIZE1); + mir_strncpy(tempraw, truncated, MAXSIZE1); // ////// while (true) { @@ -625,7 +625,7 @@ void EraseSymbols(char *truncated) recpos = position; } - strncpy(truncated, tempraw, mir_strlen(truncated)); + mir_strncpy(truncated, tempraw, mir_strlen(truncated)); free(tempraw); } @@ -640,7 +640,7 @@ void NumSymbols(char *truncated) char *tempraw = (char*)malloc(MAXSIZE1); if (truncated) - strncpy(tempraw, truncated, MAXSIZE1); + mir_strncpy(tempraw, truncated, MAXSIZE1); while (true) { Sleep(1); // avoid 100% CPU @@ -678,7 +678,7 @@ void NumSymbols(char *truncated) recpos = position; } - strncpy(truncated, tempraw, mir_strlen(truncated)); + mir_strncpy(truncated, tempraw, mir_strlen(truncated)); free(tempraw); } @@ -687,7 +687,7 @@ void FastTagFilter(char *truncated) { char *tempraw = (char*)malloc(MAXSIZE1); if (truncated) - strncpy(tempraw, truncated, MAXSIZE1); + mir_strncpy(tempraw, truncated, MAXSIZE1); for (int counter = 0; counter < mir_strlen(tempraw); counter++) { if (tempraw[counter] == '<') { @@ -703,7 +703,7 @@ void FastTagFilter(char *truncated) } } - strncpy(truncated, tempraw, mir_strlen(truncated)); + mir_strncpy(truncated, tempraw, mir_strlen(truncated)); free(tempraw); } @@ -715,7 +715,7 @@ void RemoveInvis(char *truncated, int AmountWspcRem) char *tempraw = (char*)malloc(MAXSIZE1); if (truncated) - strncpy(tempraw, truncated, MAXSIZE1); + mir_strncpy(tempraw, truncated, MAXSIZE1); switch (AmountWspcRem) { case 1: @@ -745,7 +745,7 @@ void RemoveInvis(char *truncated, int AmountWspcRem) tempraw[counter] = ' '; } // end for - strncpy(truncated, tempraw, mir_strlen(truncated)); + mir_strncpy(truncated, tempraw, mir_strlen(truncated)); free(tempraw); } @@ -754,13 +754,13 @@ void RemoveTabs(char *truncated) { char *tempraw = (char*)malloc(MAXSIZE1); if (truncated) - strncpy(tempraw, truncated, MAXSIZE1); + mir_strncpy(tempraw, truncated, MAXSIZE1); for (int counter = 0; counter < mir_strlen(tempraw); counter++) if (tempraw[counter] == '\t') tempraw[counter] = ' '; - strncpy(truncated, tempraw, mir_strlen(truncated)); + mir_strncpy(truncated, tempraw, mir_strlen(truncated)); free(tempraw); } @@ -779,7 +779,7 @@ void Removewhitespace(char *truncated) counter2++; pos2 = counter2; - strncpy(&truncated[pos1], &truncated[pos2], mir_strlen(&truncated[pos1]) - 1); + mir_strncpy(&truncated[pos1], &truncated[pos2], mir_strlen(&truncated[pos1]) - 1); } // end if } // end for } @@ -788,11 +788,11 @@ void Removewhitespace(char *truncated) void Filter(char *truncated) { char tempraw[MAXSIZE1]; - strncpy(tempraw, truncated, SIZEOF(tempraw)); + mir_strncpy(tempraw, truncated, SIZEOF(tempraw)); for (int counter = 0; counter < mir_strlen(tempraw); counter++) if ((tempraw[counter] == '\n') || (tempraw[counter] == '\r') || (tempraw[counter] == '\t')) - strncpy(&tempraw[counter], &tempraw[counter + 1], mir_strlen(&tempraw[counter]) - 1); + mir_strncpy(&tempraw[counter], &tempraw[counter + 1], mir_strlen(&tempraw[counter]) - 1); - strncpy(truncated, tempraw, mir_strlen(truncated)); + mir_strncpy(truncated, tempraw, mir_strlen(truncated)); } diff --git a/plugins/WebView/src/webview_datawnd.cpp b/plugins/WebView/src/webview_datawnd.cpp index 8857e78d1a..eaa1728cc3 100644 --- a/plugins/WebView/src/webview_datawnd.cpp +++ b/plugins/WebView/src/webview_datawnd.cpp @@ -58,7 +58,7 @@ INT_PTR CALLBACK DlgProcFind(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPara char *tempbuffer = (char*)malloc(len + 2); GetDlgItemTextA(ParentHwnd, IDC_DATA, tempbuffer, len); - strncpy(buff, tempbuffer, SIZEOF(buff)); + mir_strncpy(buff, tempbuffer, SIZEOF(buff)); free(tempbuffer); Filter(buff); diff --git a/plugins/WebView/src/webview_getdata.cpp b/plugins/WebView/src/webview_getdata.cpp index a542e21c0a..3c01680add 100644 --- a/plugins/WebView/src/webview_getdata.cpp +++ b/plugins/WebView/src/webview_getdata.cpp @@ -225,7 +225,7 @@ void GetData(void *param) } dispos = 0; - strncpy(raw, &truncated2[statpos], MallocSize); + mir_strncpy(raw, &truncated2[statpos], MallocSize); raw[MallocSize] = '\0'; trunccount = 0; @@ -334,7 +334,7 @@ void GetData(void *param) eventIndex = db_get_b(hContact, MODULENAME, EVNT_INDEX_KEY, 0); if (eventIndex == 2) { - strncpy(buff, truncated, SIZEOF(buff)); + mir_strncpy(buff, truncated, SIZEOF(buff)); Filter(buff); if (!db_get_s(hContact, MODULENAME, ALRT_S_STRING_KEY, &dbv)) { diff --git a/plugins/WhenWasIt/src/utils.cpp b/plugins/WhenWasIt/src/utils.cpp index 42bf4be905..5d78e81a7b 100644 --- a/plugins/WhenWasIt/src/utils.cpp +++ b/plugins/WhenWasIt/src/utils.cpp @@ -94,14 +94,14 @@ void HexToBin(char *inData, ULONG &size, LPBYTE &outData) { char buffer[32] = { 0 }; mir_strcpy(buffer, "0x"); - strncpy(buffer + 2, inData, HEX_SIZE); + mir_strncpy(buffer + 2, inData, HEX_SIZE); sscanf(buffer, "%x", &size); outData = (unsigned char*)new char[size * 2]; char *tmp = inData + HEX_SIZE; buffer[4] = '\0'; //mark the end of the string for (UINT i = 0; i < size; i++) { - strncpy(buffer + 2, &tmp[i * 2], 2); + mir_strncpy(buffer + 2, &tmp[i * 2], 2); sscanf(buffer, "%x", &outData[i]); } } @@ -116,7 +116,7 @@ int GetStringFromDatabase(MCONTACT hContact, char *szModule, char *szSettingName res = 0; size_t tmp = mir_strlen(dbv.pszVal); len = (tmp < size - 1) ? tmp : size - 1; - strncpy(szResult, dbv.pszVal, len); + mir_strncpy(szResult, dbv.pszVal, len); szResult[len] = '\0'; mir_free(dbv.pszVal); } @@ -125,7 +125,7 @@ int GetStringFromDatabase(MCONTACT hContact, char *szModule, char *szSettingName if (szError) { size_t tmp = mir_strlen(szError); len = (tmp < size - 1) ? tmp : size - 1; - strncpy(szResult, szError, len); + mir_strncpy(szResult, szError, len); szResult[len] = '\0'; } else szResult[0] = '\0'; diff --git a/plugins/YAMN/src/browser/mailbrowser.cpp b/plugins/YAMN/src/browser/mailbrowser.cpp index ece3465f5f..efece9892f 100644 --- a/plugins/YAMN/src/browser/mailbrowser.cpp +++ b/plugins/YAMN/src/browser/mailbrowser.cpp @@ -1073,7 +1073,7 @@ ULONGLONG MimeDateToFileTime(char *datein) if (datein) { char tmp[64]; while (datein[0] == ' ') datein++; // eat leading spaces - strncpy(tmp, datein, 63); tmp[63] = 0; + mir_strncpy(tmp, datein, 63); tmp[63] = 0; if (atoi(tmp)) { // Parseable integer on DayOfWeek field? Buggy mime date. day = tmp; } diff --git a/plugins/YAMN/src/mails/decode.cpp b/plugins/YAMN/src/mails/decode.cpp index 6ca2a0238b..8b18a509f8 100644 --- a/plugins/YAMN/src/mails/decode.cpp +++ b/plugins/YAMN/src/mails/decode.cpp @@ -495,7 +495,7 @@ void ConvertCodedStringToUnicode(char *stream,WCHAR **storeto,DWORD cp,int mode) finderend--; } char *oneWordEncoded = new char[finderend-finder+1]; - strncpy(oneWordEncoded,finder,finderend-finder); + mir_strncpy(oneWordEncoded,finder,finderend-finder); oneWordEncoded[finderend-finder]=0; switch(Encoding) { diff --git a/plugins/YAMN/src/mails/mails.cpp b/plugins/YAMN/src/mails/mails.cpp index ad9083f5b9..1212ec0e30 100644 --- a/plugins/YAMN/src/mails/mails.cpp +++ b/plugins/YAMN/src/mails/mails.cpp @@ -438,7 +438,7 @@ void WINAPI TranslateHeaderFcn(char *stream,int len,struct CMimeItem **head) if (NULL==(Item->Next=new struct CMimeItem)) break; // Cant create new item?! Item=Item->Next; Item->Next=NULL;//just in case; - Item->name=new char[5]; strncpy(Item->name,"Body",5); + Item->name=new char[5]; mir_strncpy(Item->name,"Body",5); Item->value=new char [prev2-prev1]; mir_strncpy(Item->value,prev1,prev2-prev1-1); } diff --git a/plugins/YARelay/src/main.cpp b/plugins/YARelay/src/main.cpp index a87eafb9a6..62849bc75b 100644 --- a/plugins/YARelay/src/main.cpp +++ b/plugins/YARelay/src/main.cpp @@ -205,7 +205,7 @@ static int MessageEventAdded(WPARAM hContact, LPARAM hDBEvent) char *szBuf = szUtfMsg.str; for (int i=0; i < iPartCount; i++, szBuf += cbPortion) { char *szMsgPart = (char*)mir_alloc(cbPortion+1); - strncpy(szMsgPart, szBuf, cbPortion); + mir_strncpy(szMsgPart, szBuf, cbPortion); szMsgPart[cbPortion] = 0; HANDLE hMsgProc = (HANDLE)CallContactService(hForwardTo, PSS_MESSAGE, 0, (LPARAM)szMsgPart); diff --git a/plugins/YahooGroups/src/utils.cpp b/plugins/YahooGroups/src/utils.cpp index f13cc4ee2d..a8e3742819 100644 --- a/plugins/YahooGroups/src/utils.cpp +++ b/plugins/YahooGroups/src/utils.cpp @@ -117,7 +117,7 @@ void HexToBin(char *inData, ULONG &size, LPBYTE &outData) { char buffer[32] = {0}; mir_strcpy(buffer, "0x"); - strncpy(buffer + 2, inData, HEX_SIZE); + mir_strncpy(buffer + 2, inData, HEX_SIZE); sscanf(buffer, "%x", &size); outData = (unsigned char*)new char[size*2]; UINT i; @@ -126,7 +126,7 @@ void HexToBin(char *inData, ULONG &size, LPBYTE &outData) buffer[4] = '\0'; //mark the end of the string for (i = 0; i < size; i++) { - strncpy(buffer + 2, &tmp[i * 2], 2); + mir_strncpy(buffer + 2, &tmp[i * 2], 2); sscanf(buffer, "%x", &outData[i]); } i = size; @@ -143,7 +143,7 @@ int GetStringFromDatabase(MCONTACT hContact, char *szModule, char *szSettingName res = 0; int tmp = (int)mir_strlen(dbv.pszVal); len = (tmp < size - 1) ? tmp : size - 1; - strncpy(szResult, dbv.pszVal, len); + mir_strncpy(szResult, dbv.pszVal, len); szResult[len] = '\0'; mir_free(dbv.pszVal); } @@ -153,7 +153,7 @@ int GetStringFromDatabase(MCONTACT hContact, char *szModule, char *szSettingName { int tmp = (int)mir_strlen(szError); len = (tmp < size - 1) ? tmp : size - 1; - strncpy(szResult, szError, len); + mir_strncpy(szResult, szError, len); szResult[len] = '\0'; } else{ diff --git a/plugins/helpers/gen_helpers.cpp b/plugins/helpers/gen_helpers.cpp index dae6100000..edfaff270d 100644 --- a/plugins/helpers/gen_helpers.cpp +++ b/plugins/helpers/gen_helpers.cpp @@ -87,7 +87,7 @@ int AddDebugLogMessageA(const char* fmt, ...) #ifdef MODULENAME mir_snprintf(szFinal, SIZEOF(szFinal), "%s: %s", MODULENAME, szText); #else - strncpy(szFinal, szText, SIZEOF(szFinal)); + mir_strncpy(szFinal, szText, SIZEOF(szFinal)); #endif res = WriteToDebugLogA(szFinal); -- cgit v1.2.3