summaryrefslogtreecommitdiff
path: root/src/modules
diff options
context:
space:
mode:
Diffstat (limited to 'src/modules')
-rw-r--r--src/modules/chat/chat_opts.cpp2
-rw-r--r--src/modules/chat/chat_rtf.cpp15
-rw-r--r--src/modules/chat/log.cpp2
-rw-r--r--src/modules/chat/tools.cpp2
-rw-r--r--src/modules/clist/clistmod.cpp2
-rw-r--r--src/modules/clist/contact.cpp2
-rw-r--r--src/modules/database/database.cpp8
-rw-r--r--src/modules/fonts/FontOptions.cpp4
-rw-r--r--src/modules/fonts/FontService.cpp8
-rw-r--r--src/modules/fonts/services.cpp2
-rw-r--r--src/modules/icolib/skin2icons.cpp5
-rw-r--r--src/modules/icolib/skin2opts.cpp2
-rw-r--r--src/modules/metacontacts/meta_edit.cpp6
-rw-r--r--src/modules/metacontacts/meta_menu.cpp2
-rw-r--r--src/modules/metacontacts/meta_services.cpp4
-rw-r--r--src/modules/metacontacts/meta_utils.cpp2
-rw-r--r--src/modules/netlib/netliblog.cpp10
-rw-r--r--src/modules/options/options.cpp6
-rw-r--r--src/modules/plugins/newplugins.cpp2
-rw-r--r--src/modules/plugins/pluginopts.cpp2
-rw-r--r--src/modules/skin/sounds.cpp2
21 files changed, 40 insertions, 50 deletions
diff --git a/src/modules/chat/chat_opts.cpp b/src/modules/chat/chat_opts.cpp
index 872bf4a033..5a2497b21a 100644
--- a/src/modules/chat/chat_opts.cpp
+++ b/src/modules/chat/chat_opts.cpp
@@ -171,7 +171,7 @@ void RegisterFonts(void)
_tcsncpy_s(fontid.backgroundName, LPGENT("Group chat log background"), _TRUNCATE);
break;
}
- _tcsncpy(fontid.deffontsettings.szFace, FO.szDefFace, SIZEOF(fontid.deffontsettings.szFace));
+ _tcsncpy_s(fontid.deffontsettings.szFace, FO.szDefFace, _TRUNCATE);
fontid.deffontsettings.charset = FO.defCharset;
fontid.deffontsettings.colour = FO.defColour;
fontid.deffontsettings.size = FO.defSize;
diff --git a/src/modules/chat/chat_rtf.cpp b/src/modules/chat/chat_rtf.cpp
index 2cff984c84..8373a833d5 100644
--- a/src/modules/chat/chat_rtf.cpp
+++ b/src/modules/chat/chat_rtf.cpp
@@ -167,16 +167,11 @@ int DoRtfToTags(CMString &pszText, int iNumColors, COLORREF *pColors)
}
else if (p[1] == '\'') { // special character
if (p[2] != ' ' && p[2] != '\\') {
- TCHAR tmp[10];
-
- if (p[3] != ' ' && p[3] != '\\') {
- _tcsncpy(tmp, p + 2, 3);
- tmp[3] = 0;
- }
- else {
- _tcsncpy(tmp, p + 2, 2);
- tmp[2] = 0;
- }
+ TCHAR tmp[10], *t = tmp;
+ *t++ = p[2];
+ if (p[3] != ' ' && p[3] != '\\')
+ *t++ = p[3];
+ *t = 0;
// convert string containing char in hex format to int.
TCHAR *stoppedHere;
diff --git a/src/modules/chat/log.cpp b/src/modules/chat/log.cpp
index 44b0ac9248..9be458b09d 100644
--- a/src/modules/chat/log.cpp
+++ b/src/modules/chat/log.cpp
@@ -316,7 +316,7 @@ TCHAR* MakeTimeStamp(TCHAR *pszStamp, time_t time)
{
static TCHAR szTime[30];
if (!_tcsftime(szTime, SIZEOF(szTime)-1, pszStamp, localtime(&time)))
- _tcsncpy(szTime, TranslateT("<invalid>"), SIZEOF(szTime));
+ _tcsncpy_s(szTime, TranslateT("<invalid>"), _TRUNCATE);
return szTime;
}
diff --git a/src/modules/chat/tools.cpp b/src/modules/chat/tools.cpp
index 6f06421591..061555ccc4 100644
--- a/src/modules/chat/tools.cpp
+++ b/src/modules/chat/tools.cpp
@@ -463,7 +463,7 @@ BOOL LogToFile(SESSION_INFO *si, GCEVENT *gce)
BOOL bFileJustCreated = !PathFileExists(si->pszLogFileName);
TCHAR tszFolder[MAX_PATH];
- _tcscpy(tszFolder, si->pszLogFileName);
+ _tcsncpy_s(tszFolder, si->pszLogFileName, _TRUNCATE);
PathRemoveFileSpec(tszFolder);
if (!PathIsDirectory(tszFolder))
CreateDirectoryTreeT(tszFolder);
diff --git a/src/modules/clist/clistmod.cpp b/src/modules/clist/clistmod.cpp
index 22e7fbb493..74d4a38aa8 100644
--- a/src/modules/clist/clistmod.cpp
+++ b/src/modules/clist/clistmod.cpp
@@ -462,7 +462,7 @@ static INT_PTR CompareContacts(WPARAM wParam, LPARAM lParam)
}
nameb = cli.pfnGetContactDisplayName(a, 0);
- _tcsncpy(namea, nameb, SIZEOF(namea));
+ _tcsncpy_s(namea, nameb, _TRUNCATE);
namea[ SIZEOF(namea)-1 ] = 0;
nameb = cli.pfnGetContactDisplayName(b, 0);
diff --git a/src/modules/clist/contact.cpp b/src/modules/clist/contact.cpp
index a93e9ca117..64c2727c86 100644
--- a/src/modules/clist/contact.cpp
+++ b/src/modules/clist/contact.cpp
@@ -125,7 +125,7 @@ int fnCompareContacts(const ClcContact* c1, const ClcContact* c2)
}
nameb = cli.pfnGetContactDisplayName(a, 0);
- _tcsncpy(namea, nameb, SIZEOF(namea));
+ _tcsncpy_s(namea, nameb, _TRUNCATE);
namea[ SIZEOF(namea)-1 ] = 0;
nameb = cli.pfnGetContactDisplayName(b, 0);
diff --git a/src/modules/database/database.cpp b/src/modules/database/database.cpp
index c39a7eb434..f16bc48058 100644
--- a/src/modules/database/database.cpp
+++ b/src/modules/database/database.cpp
@@ -135,18 +135,18 @@ static void getDefaultProfile(TCHAR *szProfile, size_t cch)
static void loadProfileByShortName(const TCHAR* src, TCHAR *szProfile, size_t cch)
{
TCHAR buf[MAX_PATH];
- _tcsncpy(buf, src, SIZEOF(buf));
+ _tcsncpy_s(buf, src, _TRUNCATE);
TCHAR *p = _tcsrchr(buf, '\\'); if (p) ++p; else p = buf;
if (!isValidProfileName(buf) && *p)
_tcscat(buf, _T(".dat"));
TCHAR profileName[MAX_PATH], newProfileDir[MAX_PATH];
- _tcscpy(profileName, p);
+ _tcsncpy_s(profileName, p, _TRUNCATE);
if (!isValidProfileName(profileName) && *p)
_tcscat(profileName, _T(".dat"));
- _tcscpy(profileName, p);
+ _tcsncpy_s(profileName, p, _TRUNCATE);
p = _tcsrchr(profileName, '.'); if (p) *p = 0;
mir_sntprintf(newProfileDir, cch, _T("%s\\%s\\"), g_profileDir, profileName);
@@ -184,7 +184,7 @@ static void moveProfileDirProfiles(TCHAR *profiledir, BOOL isRootDir = TRUE)
{
TCHAR pfd[MAX_PATH];
if (isRootDir)
- _tcsncpy(pfd, VARST(_T("%miranda_path%\\*.dat")), SIZEOF(pfd));
+ _tcsncpy_s(pfd, VARST(_T("%miranda_path%\\*.dat")), _TRUNCATE);
else
mir_sntprintf(pfd, SIZEOF(pfd), _T("%s\\*.dat"), profiledir);
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;
diff --git a/src/modules/icolib/skin2icons.cpp b/src/modules/icolib/skin2icons.cpp
index da484434a5..101196705b 100644
--- a/src/modules/icolib/skin2icons.cpp
+++ b/src/modules/icolib/skin2icons.cpp
@@ -119,10 +119,9 @@ IconSourceFile* IconSourceFile_Get(const TCHAR* file, bool isPath)
return NULL;
if (isPath)
- PathToAbsoluteT(file, fileFull);
- /// TODO: convert path to long - eliminate duplicate items
+ PathToAbsoluteT(file, fileFull); /// TODO: convert path to long - eliminate duplicate items
else
- _tcscpy(fileFull, file);
+ _tcsncpy_s(fileFull, file, _TRUNCATE);
IconSourceFile key = { fileFull };
int ix;
diff --git a/src/modules/icolib/skin2opts.cpp b/src/modules/icolib/skin2opts.cpp
index 79942519b9..cb11ca0066 100644
--- a/src/modules/icolib/skin2opts.cpp
+++ b/src/modules/icolib/skin2opts.cpp
@@ -970,7 +970,7 @@ INT_PTR CALLBACK DlgProcIcoLibOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM
if (lvi.lParam < iconList.getCount()) {
item = iconList[lvi.lParam];
if (item->temp_file)
- _tcsncpy(pInfoTip->pszText, item->temp_file, pInfoTip->cchTextMax);
+ _tcsncpy_s(pInfoTip->pszText, pInfoTip->cchTextMax, item->temp_file, _TRUNCATE);
else if (item->default_file)
mir_sntprintf(pInfoTip->pszText, pInfoTip->cchTextMax, _T("%s, %d"), item->default_file, item->default_indx);
}
diff --git a/src/modules/metacontacts/meta_edit.cpp b/src/modules/metacontacts/meta_edit.cpp
index 2a6de57602..7938b398be 100644
--- a/src/modules/metacontacts/meta_edit.cpp
+++ b/src/modules/metacontacts/meta_edit.cpp
@@ -71,10 +71,10 @@ static void FillContactList(HWND hList)
if (!db_get(g_data.hContact[i], szProto, szField, &dbv)) {
switch (dbv.type) {
case DBVT_ASCIIZ:
- _tcsncpy(buff, _A2T(dbv.pszVal), SIZEOF(buff));
+ _tcsncpy_s(buff, _A2T(dbv.pszVal), _TRUNCATE);
break;
case DBVT_WCHAR:
- _tcsncpy(buff, dbv.ptszVal, SIZEOF(buff));
+ _tcsncpy_s(buff, dbv.ptszVal, _TRUNCATE);
break;
case DBVT_BYTE:
_itot(dbv.bVal, buff, 10);
@@ -166,7 +166,7 @@ static void ApplyChanges()
PROTO_AVATAR_INFORMATIONT AI = { sizeof(AI) };
AI.hContact = g_data.hMeta;
AI.format = PA_FORMAT_UNKNOWN;
- _tcscpy(AI.filename, _T("X"));
+ _tcsncpy_s(AI.filename, _T("X"), _TRUNCATE);
if (CallProtoService(META_PROTO, PS_GETAVATARINFOT, 0, (LPARAM)&AI) == GAIR_SUCCESS)
db_set_ts(g_data.hMeta, "ContactPhoto", "File", AI.filename);
}
diff --git a/src/modules/metacontacts/meta_menu.cpp b/src/modules/metacontacts/meta_menu.cpp
index 4dc8c390c1..af8a2177f6 100644
--- a/src/modules/metacontacts/meta_menu.cpp
+++ b/src/modules/metacontacts/meta_menu.cpp
@@ -162,7 +162,7 @@ void Meta_RemoveContactNumber(DBCachedContact *ccMeta, int number, bool bUpdateI
PROTO_AVATAR_INFORMATIONT AI = { sizeof(AI) };
AI.hContact = ccMeta->contactID;
AI.format = PA_FORMAT_UNKNOWN;
- _tcscpy(AI.filename, _T("X"));
+ _tcsncpy_s(AI.filename, _T("X"), _TRUNCATE);
if (CallProtoService(META_PROTO, PS_GETAVATARINFOT, 0, (LPARAM)&AI) == GAIR_SUCCESS)
db_set_ts(ccMeta->contactID, "ContactPhoto", "File", AI.filename);
diff --git a/src/modules/metacontacts/meta_services.cpp b/src/modules/metacontacts/meta_services.cpp
index 033afc4b25..0a36da6572 100644
--- a/src/modules/metacontacts/meta_services.cpp
+++ b/src/modules/metacontacts/meta_services.cpp
@@ -448,7 +448,7 @@ int Meta_SettingChanged(WPARAM hContact, LPARAM lParam)
PROTO_AVATAR_INFORMATIONT AI = { sizeof(AI) };
AI.hContact = ccMeta->contactID;
AI.format = PA_FORMAT_UNKNOWN;
- _tcscpy(AI.filename, _T("X"));
+ _tcsncpy_s(AI.filename, _T("X"), _TRUNCATE);
if (CallProtoService(META_PROTO, PS_GETAVATARINFOT, 0, (LPARAM)&AI) == GAIR_SUCCESS)
db_set_ts(ccMeta->contactID, "ContactPhoto", "File", AI.filename);
}
@@ -798,7 +798,7 @@ INT_PTR Meta_GetInfo(WPARAM wParam, LPARAM lParam)
AI.cbSize = sizeof(AI);
AI.hContact = ccs->hContact;
AI.format = PA_FORMAT_UNKNOWN;
- _tcscpy(AI.filename, _T("X"));
+ _tcsncpy_s(AI.filename, _T("X"), _TRUNCATE);
if (CallProtoService(META_PROTO, PS_GETAVATARINFOT, 0, (LPARAM)&AI) == GAIR_SUCCESS)
db_set_ts(ccs->hContact, "ContactPhoto", "File", AI.filename);
diff --git a/src/modules/metacontacts/meta_utils.cpp b/src/modules/metacontacts/meta_utils.cpp
index 6955973266..761948b0b4 100644
--- a/src/modules/metacontacts/meta_utils.cpp
+++ b/src/modules/metacontacts/meta_utils.cpp
@@ -195,7 +195,7 @@ BOOL Meta_Assign(MCONTACT hSub, MCONTACT hMeta, BOOL set_as_default)
AI.cbSize = sizeof(AI);
AI.hContact = hMeta;
AI.format = PA_FORMAT_UNKNOWN;
- _tcscpy(AI.filename, _T("X"));
+ _tcsncpy_s(AI.filename, _T("X"), _TRUNCATE);
if (CallProtoService(META_PROTO, PS_GETAVATARINFOT, 0, (LPARAM)&AI) == GAIR_SUCCESS)
db_set_ts(hMeta, "ContactPhoto", "File", AI.filename);
diff --git a/src/modules/netlib/netliblog.cpp b/src/modules/netlib/netliblog.cpp
index 9a3aa08ebb..5590d2305c 100644
--- a/src/modules/netlib/netliblog.cpp
+++ b/src/modules/netlib/netliblog.cpp
@@ -159,7 +159,9 @@ static INT_PTR CALLBACK LogOptionsDlgProc(HWND hwndDlg, UINT message, WPARAM wPa
case IDC_RUNATSTARTBROWSE:
GetWindowText(GetWindow((HWND)lParam, GW_HWNDPREV), str, SIZEOF(str));
{
- TCHAR filter[512];
+ TCHAR filter[200];
+ mir_sntprintf(filter, SIZEOF(filter), _T("%s (*)%c*%c"), TranslateT("All files"), 0, 0);
+
OPENFILENAME ofn = { 0 };
ofn.lStructSize = OPENFILENAME_SIZE_VERSION_400;
ofn.hwndOwner = hwndDlg;
@@ -170,12 +172,6 @@ static INT_PTR CALLBACK LogOptionsDlgProc(HWND hwndDlg, UINT message, WPARAM wPa
ofn.Flags |= OFN_PATHMUSTEXIST | OFN_FILEMUSTEXIST;
ofn.lpstrTitle = TranslateT("Select program to be run");
}
- _tcsncpy(filter, TranslateT("All files"), SIZEOF(filter) - 1);
- _tcscat(filter, _T(" (*)"));
- TCHAR *pfilter = filter + mir_tstrlen(filter) + 1;
- _tcscpy(pfilter, _T("*"));
- pfilter = pfilter + mir_tstrlen(pfilter) + 1;
- *pfilter = '\0';
ofn.lpstrFilter = filter;
ofn.lpstrFile = str;
ofn.nMaxFile = SIZEOF(str) - 2;
diff --git a/src/modules/options/options.cpp b/src/modules/options/options.cpp
index bfdcb82147..f9ae5965f7 100644
--- a/src/modules/options/options.cpp
+++ b/src/modules/options/options.cpp
@@ -209,7 +209,7 @@ static TCHAR* GetPluginName(HINSTANCE hInstance, TCHAR *buffer, int size)
else
dllName++;
- _tcsncpy(buffer, dllName, size);
+ _tcsncpy_s(buffer, size, dllName, _TRUNCATE);
return buffer;
}
@@ -517,7 +517,7 @@ static void RebuildPageTree(HWND hdlg, OptionsDlgData *dat)
else
pos = szFileName;
- _tcsncpy(dat->szFilterString, pos, SIZEOF(dat->szFilterString));
+ _tcsncpy_s(dat->szFilterString, pos, _TRUNCATE);
}
else {
int sel = SendDlgItemMessage(hdlg, IDC_KEYWORD_FILTER, (UINT)CB_GETCURSEL, 0, 0);
@@ -528,7 +528,7 @@ static void RebuildPageTree(HWND hdlg, OptionsDlgData *dat)
TCHAR *pos = _tcsrchr(szFileName, _T('\\'));
if (pos) pos++;
else pos = szFileName;
- _tcsncpy(dat->szFilterString, pos, SIZEOF(dat->szFilterString));
+ _tcsncpy_s(dat->szFilterString, pos, _TRUNCATE);
}
}
diff --git a/src/modules/plugins/newplugins.cpp b/src/modules/plugins/newplugins.cpp
index 511ab1fdd4..ff12e0d907 100644
--- a/src/modules/plugins/newplugins.cpp
+++ b/src/modules/plugins/newplugins.cpp
@@ -392,7 +392,7 @@ void enumPlugins(SCAN_PLUGINS_CALLBACK cb, WPARAM wParam, LPARAM lParam)
pluginEntry* OpenPlugin(TCHAR *tszFileName, TCHAR *dir, TCHAR *path)
{
pluginEntry *p = (pluginEntry*)HeapAlloc(hPluginListHeap, HEAP_NO_SERIALIZE | HEAP_ZERO_MEMORY, sizeof(pluginEntry));
- _tcsncpy(p->pluginname, tszFileName, SIZEOF(p->pluginname));
+ _tcsncpy_s(p->pluginname, tszFileName, _TRUNCATE);
// add it to the list anyway
pluginList.insert(p);
diff --git a/src/modules/plugins/pluginopts.cpp b/src/modules/plugins/pluginopts.cpp
index ab774cae9f..61d0205689 100644
--- a/src/modules/plugins/pluginopts.cpp
+++ b/src/modules/plugins/pluginopts.cpp
@@ -85,7 +85,7 @@ static BOOL dialogListPlugins(WIN32_FIND_DATA *fd, TCHAR *path, WPARAM, LPARAM l
}
CharLower(fd->cFileName);
- _tcsncpy(dat->fileName, fd->cFileName, SIZEOF(dat->fileName));
+ _tcsncpy_s(dat->fileName, fd->cFileName, _TRUNCATE);
HWND hwndList = (HWND)lParam;
diff --git a/src/modules/skin/sounds.cpp b/src/modules/skin/sounds.cpp
index 1921d528b7..d7ca6a2379 100644
--- a/src/modules/skin/sounds.cpp
+++ b/src/modules/skin/sounds.cpp
@@ -289,7 +289,7 @@ INT_PTR CALLBACK DlgProcSoundOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM
TCHAR str[MAX_PATH], strFull[MAX_PATH], strdir[MAX_PATH], filter[MAX_PATH];
if (snd.ptszTempFile)
- _tcsncpy(strFull, snd.ptszTempFile, SIZEOF(strFull));
+ _tcsncpy_s(strFull, snd.ptszTempFile, _TRUNCATE);
else {
if (db_get_b(NULL, "SkinSoundsOff", snd.name, 0) == 0) {
DBVARIANT dbv;