From 6e2b6b31bae6d69bff5271451e73eb08637b8118 Mon Sep 17 00:00:00 2001 From: Rozhuk Ivan Date: Tue, 2 Dec 2014 03:47:27 +0000 Subject: mir_sntprintf(..., _T("%s"), ...) -> _tcsncpy_s(..., ..., _TRUNCATE) fix some x64 ptr truncations git-svn-id: http://svn.miranda-ng.org/main/trunk@11211 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- src/modules/fonts/FontOptions.cpp | 4 ++-- src/modules/fonts/services.cpp | 6 ++++-- 2 files changed, 6 insertions(+), 4 deletions(-) (limited to 'src/modules/fonts') diff --git a/src/modules/fonts/FontOptions.cpp b/src/modules/fonts/FontOptions.cpp index 97598e7674..3091965994 100644 --- a/src/modules/fonts/FontOptions.cpp +++ b/src/modules/fonts/FontOptions.cpp @@ -522,7 +522,7 @@ static void sttSaveFontData(HWND hwndDlg, FontInternal &F) if (F.flags & FIDF_APPENDNAME) mir_snprintf(str, SIZEOF(str), "%sName", F.prefix); else - mir_snprintf(str, SIZEOF(str), "%s", F.prefix); + strncpy_s(str, F.prefix, _TRUNCATE); if (db_set_ts(NULL, F.dbSettingsGroup, str, F.value.szFace)) { char buff[1024]; @@ -1185,7 +1185,7 @@ static INT_PTR CALLBACK DlgProcLogOptions(HWND hwndDlg, UINT msg, WPARAM wParam, for (i=0; i < colour_id_list_w2.getCount(); i++) { ColourInternal& C = colour_id_list_w2[i]; - mir_snprintf(str, SIZEOF(str), "%s", C.setting); + strncpy_s(str, C.setting, _TRUNCATE); db_set_dw(NULL, C.dbSettingsGroup, str, C.value); } diff --git a/src/modules/fonts/services.cpp b/src/modules/fonts/services.cpp index 1c7b0783dd..63ab76242c 100644 --- a/src/modules/fonts/services.cpp +++ b/src/modules/fonts/services.cpp @@ -142,8 +142,10 @@ int GetFontSettingFromDB(char *settings_group, char *prefix, LOGFONT* lf, COLORR GetDefaultFontSetting(lf, colour); - if (flags & FIDF_APPENDNAME) mir_snprintf(idstr, SIZEOF(idstr), "%sName", prefix); - else mir_snprintf(idstr, SIZEOF(idstr), "%s", prefix); + if (flags & FIDF_APPENDNAME) + mir_snprintf(idstr, SIZEOF(idstr), "%sName", prefix); + else + strncpy_s(idstr, prefix, _TRUNCATE); if (!db_get_ts(NULL, settings_group, idstr, &dbv)) { _tcscpy(lf->lfFaceName, dbv.ptszVal); -- cgit v1.2.3