summaryrefslogtreecommitdiff
path: root/plugins/TabSRMM/src/container.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/TabSRMM/src/container.cpp')
-rw-r--r--plugins/TabSRMM/src/container.cpp11
1 files changed, 4 insertions, 7 deletions
diff --git a/plugins/TabSRMM/src/container.cpp b/plugins/TabSRMM/src/container.cpp
index 37f5c4a4d9..7239a16651 100644
--- a/plugins/TabSRMM/src/container.cpp
+++ b/plugins/TabSRMM/src/container.cpp
@@ -1990,15 +1990,12 @@ int TSAPI CutContactName(const TCHAR *oldname, TCHAR *newname, unsigned int size
{
int cutMax = PluginConfig.m_CutContactNameTo;
- if (mir_tstrlen(oldname) <= cutMax) {
- mir_tstrncpy(newname, oldname, size);
- newname[size - 1] = 0;
- }
+ if (mir_tstrlen(oldname) <= cutMax)
+ _tcsncpy_s(newname, size, oldname, _TRUNCATE);
else {
- TCHAR fmt[20];
- mir_sntprintf(fmt, 18, _T("%%%d.%ds..."), cutMax, cutMax);
+ TCHAR fmt[30];
+ mir_sntprintf(fmt, SIZEOF(fmt), _T("%%%d.%ds..."), cutMax, cutMax);
mir_sntprintf(newname, size, fmt, oldname);
- newname[size - 1] = 0;
}
return 0;
}