From 303e6b483aff4126701ca375dd085e9ae1d18b43 Mon Sep 17 00:00:00 2001 From: Rozhuk Ivan Date: Sat, 13 Dec 2014 08:01:55 +0000 Subject: multiple buf size fixes git-svn-id: http://svn.miranda-ng.org/main/trunk@11361 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- src/mir_core/langpack.cpp | 2 +- src/modules/chat/chat_opts.cpp | 6 ++---- src/modules/clist/clisttray.cpp | 4 ++-- 3 files changed, 5 insertions(+), 7 deletions(-) (limited to 'src') diff --git a/src/mir_core/langpack.cpp b/src/mir_core/langpack.cpp index 362e1230ba..29f633bc45 100644 --- a/src/mir_core/langpack.cpp +++ b/src/mir_core/langpack.cpp @@ -364,7 +364,7 @@ static int LoadLangDescr(LANGPACK_INFO &lpinfo, FILE *fp, char *line, int &start if (!lpinfo.tszLanguage[0] && (lpinfo.Locale == 0) || !GetLocaleInfo(lpinfo.Locale, LOCALE_SENGLANGUAGE, lpinfo.tszLanguage, sizeof(lpinfo.tszLanguage))) { TCHAR *p = _tcschr(lpinfo.tszFileName, '_'); - mir_tstrncpy(lpinfo.tszLanguage, p != NULL ? p + 1 : lpinfo.tszFileName, sizeof(lpinfo.tszLanguage)); + _tcsncpy_s(lpinfo.tszLanguage, ((p != NULL) ? (p + 1) : lpinfo.tszFileName), _TRUNCATE); p = _tcsrchr(lpinfo.tszLanguage, _T('.')); if (p != NULL) *p = '\0'; } diff --git a/src/modules/chat/chat_opts.cpp b/src/modules/chat/chat_opts.cpp index 720f643acf..872bf4a033 100644 --- a/src/modules/chat/chat_opts.cpp +++ b/src/modules/chat/chat_opts.cpp @@ -141,12 +141,10 @@ void RegisterFonts(void) for (int i = 0; i < SIZEOF(fontOptionsList); i++, index++) { FontOptionsList &FO = fontOptionsList[i]; - strncpy(fontid.dbSettingsGroup, CHATFONT_MODULE, sizeof(fontid.dbSettingsGroup)); + strncpy_s(fontid.dbSettingsGroup, CHATFONT_MODULE, _TRUNCATE); _tcsncpy_s(fontid.name, FO.szDescr, _TRUNCATE); - char idstr[10]; - mir_snprintf(idstr, SIZEOF(idstr), "Font%d", index); - strncpy(fontid.prefix, idstr, sizeof(fontid.prefix)); + mir_snprintf(fontid.prefix, SIZEOF(fontid.prefix), "Font%d", index); fontid.order = index; switch (i) { diff --git a/src/modules/clist/clisttray.cpp b/src/modules/clist/clisttray.cpp index 8cb1a16d47..3907f8f922 100644 --- a/src/modules/clist/clisttray.cpp +++ b/src/modules/clist/clisttray.cpp @@ -829,8 +829,8 @@ int fnCListTrayNotify(MIRANDASYSTRAYNOTIFY* msn) nid.hWnd = cli.hwndContactList; nid.uID = iconId; nid.uFlags = NIF_INFO; - mir_strncpy(nid.szInfo, msn->szInfo, sizeof(nid.szInfo)); - mir_strncpy(nid.szInfoTitle, msn->szInfoTitle, sizeof(nid.szInfoTitle)); + strncpy_s(nid.szInfo, msn->szInfo, _TRUNCATE); + strncpy_s(nid.szInfoTitle, msn->szInfoTitle, _TRUNCATE); nid.uTimeout = msn->uTimeout; nid.dwInfoFlags = msn->dwInfoFlags; return Shell_NotifyIconA(NIM_MODIFY, &nid) == 0; -- cgit v1.2.3