summaryrefslogtreecommitdiff
path: root/src/modules/fonts
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2015-04-11 15:20:17 +0000
committerGeorge Hazan <george.hazan@gmail.com>2015-04-11 15:20:17 +0000
commit7e315d1103af9248583483da99e96ca339bf2d20 (patch)
tree6398336a2286278e6857e3205247ba0ed74a2e20 /src/modules/fonts
parentc391c203e82d635e58561911ac7753c1d1261cc9 (diff)
unsafe string operations replaced with safe wherever possible
git-svn-id: http://svn.miranda-ng.org/main/trunk@12768 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'src/modules/fonts')
-rw-r--r--src/modules/fonts/FontOptions.cpp4
-rw-r--r--src/modules/fonts/FontService.cpp8
-rw-r--r--src/modules/fonts/services.cpp2
3 files changed, 7 insertions, 7 deletions
diff --git a/src/modules/fonts/FontOptions.cpp b/src/modules/fonts/FontOptions.cpp
index e9bfe677d4..8b9b20f641 100644
--- a/src/modules/fonts/FontOptions.cpp
+++ b/src/modules/fonts/FontOptions.cpp
@@ -965,7 +965,7 @@ static INT_PTR CALLBACK DlgProcLogOptions(HWND hwndDlg, UINT msg, WPARAM wParam,
F1.value.size = (char)lf.lfHeight;
F1.value.style = (lf.lfWeight >= FW_BOLD ? DBFONTF_BOLD : 0) | (lf.lfItalic ? DBFONTF_ITALIC : 0) | (lf.lfUnderline ? DBFONTF_UNDERLINE : 0) | (lf.lfStrikeOut ? DBFONTF_STRIKEOUT : 0);
F1.value.charset = lf.lfCharSet;
- _tcscpy(F1.value.szFace, lf.lfFaceName);
+ _tcsncpy_s(F1.value.szFace, lf.lfFaceName, _TRUNCATE);
MEASUREITEMSTRUCT mis = { 0 };
mis.CtlID = IDC_FONTLIST;
@@ -1310,7 +1310,7 @@ static INT_PTR CALLBACK DlgProcModernOptions(HWND hwndDlg, UINT msg, WPARAM wPar
pf->value.size = (char)lf.lfHeight;
pf->value.style = (lf.lfWeight >= FW_BOLD ? DBFONTF_BOLD : 0) | (lf.lfItalic ? DBFONTF_ITALIC : 0) | (lf.lfUnderline ? DBFONTF_UNDERLINE : 0) | (lf.lfStrikeOut ? DBFONTF_STRIKEOUT : 0);
pf->value.charset = lf.lfCharSet;
- _tcscpy(pf->value.szFace, lf.lfFaceName);
+ _tcsncpy_s(pf->value.szFace, lf.lfFaceName, _TRUNCATE);
InvalidateRect( GetDlgItem(hwndDlg, IDC_PREVIEWHEADER), NULL, TRUE);
InvalidateRect( GetDlgItem(hwndDlg, IDC_PREVIEWGENERAL), NULL, TRUE);
diff --git a/src/modules/fonts/FontService.cpp b/src/modules/fonts/FontService.cpp
index b9dc7b7f32..166110f2a8 100644
--- a/src/modules/fonts/FontService.cpp
+++ b/src/modules/fonts/FontService.cpp
@@ -91,19 +91,19 @@ int LoadFontserviceModule(void)
// create generic fonts
FontIDT fontid = { sizeof(fontid) };
strncpy(fontid.dbSettingsGroup, "Fonts", sizeof(fontid.dbSettingsGroup));
- _tcsncpy(fontid.group, LPGENT("General"), SIZEOF(fontid.group));
+ _tcsncpy_s(fontid.group, LPGENT("General"), _TRUNCATE);
- _tcsncpy(fontid.name, LPGENT("Headers"), SIZEOF(fontid.name));
+ _tcsncpy_s(fontid.name, LPGENT("Headers"), _TRUNCATE);
fontid.flags = FIDF_APPENDNAME | FIDF_NOAS | FIDF_SAVEPOINTSIZE | FIDF_ALLOWEFFECTS | FIDF_CLASSHEADER;
strncpy(fontid.prefix, "Header", SIZEOF(fontid.prefix));
FontRegisterT(&fontid);
- _tcsncpy(fontid.name, LPGENT("Generic text"), SIZEOF(fontid.name));
+ _tcsncpy_s(fontid.name, LPGENT("Generic text"), _TRUNCATE);
fontid.flags = FIDF_APPENDNAME | FIDF_NOAS | FIDF_SAVEPOINTSIZE | FIDF_ALLOWEFFECTS | FIDF_CLASSGENERAL;
strncpy(fontid.prefix, "Generic", SIZEOF(fontid.prefix));
FontRegisterT(&fontid);
- _tcsncpy(fontid.name, LPGENT("Small text"), SIZEOF(fontid.name));
+ _tcsncpy_s(fontid.name, LPGENT("Small text"), _TRUNCATE);
fontid.flags = FIDF_APPENDNAME | FIDF_NOAS | FIDF_SAVEPOINTSIZE | FIDF_ALLOWEFFECTS | FIDF_CLASSSMALL;
strncpy(fontid.prefix, "Small", SIZEOF(fontid.prefix));
FontRegisterT(&fontid);
diff --git a/src/modules/fonts/services.cpp b/src/modules/fonts/services.cpp
index a1107f75ef..39805750dc 100644
--- a/src/modules/fonts/services.cpp
+++ b/src/modules/fonts/services.cpp
@@ -200,7 +200,7 @@ int CreateFromFontSettings(FontSettingsT *fs, LOGFONT *lf)
{
GetDefaultFontSetting(lf, 0);
- _tcscpy(lf->lfFaceName, fs->szFace);
+ _tcsncpy_s(lf->lfFaceName, fs->szFace, _TRUNCATE);
lf->lfWidth = lf->lfEscapement = lf->lfOrientation = 0;
lf->lfWeight = fs->style & DBFONTF_BOLD ? FW_BOLD : FW_NORMAL;