From 777da6a8fa210d027e5fd47919a8d7c18b9c5613 Mon Sep 17 00:00:00 2001 From: Rozhuk Ivan Date: Mon, 1 Dec 2014 00:52:05 +0000 Subject: fix buf size for mir_sntprintf() git-svn-id: http://svn.miranda-ng.org/main/trunk@11186 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/AvatarHistory/src/AvatarDlg.cpp | 2 +- plugins/Clist_modern/src/modern_clistmenus.cpp | 4 ++-- plugins/FTPFileYM/src/job_generic.cpp | 2 +- plugins/Nudge/src/main.cpp | 2 +- plugins/Nudge/src/options.cpp | 2 +- plugins/Spamotron/src/spamotron.cpp | 2 +- protocols/Gadu-Gadu/src/gg_proto.cpp | 2 +- protocols/IcqOscarJ/src/changeinfo/dlgproc.cpp | 2 +- src/modules/langpack/lpopts.cpp | 2 +- 9 files changed, 10 insertions(+), 10 deletions(-) diff --git a/plugins/AvatarHistory/src/AvatarDlg.cpp b/plugins/AvatarHistory/src/AvatarDlg.cpp index 3c8eb75463..0102758453 100644 --- a/plugins/AvatarHistory/src/AvatarDlg.cpp +++ b/plugins/AvatarHistory/src/AvatarDlg.cpp @@ -560,7 +560,7 @@ int ShowSaveDialog(HWND hwnd, TCHAR* fn, MCONTACT hContact) TCHAR title[MAX_PATH]; if (displayName) { - mir_sntprintf(title,sizeof(title),TranslateT("Save Avatar for %s"),displayName); + mir_sntprintf(title, SIZEOF(title), TranslateT("Save Avatar for %s"), displayName); ofn.lpstrTitle = title; } else diff --git a/plugins/Clist_modern/src/modern_clistmenus.cpp b/plugins/Clist_modern/src/modern_clistmenus.cpp index 2fe2157340..11e6bafaaf 100644 --- a/plugins/Clist_modern/src/modern_clistmenus.cpp +++ b/plugins/Clist_modern/src/modern_clistmenus.cpp @@ -108,9 +108,9 @@ static int FAV_OnContactMenuBuild(WPARAM hContact, LPARAM) mi.ptszName = FAVMENUROOTNAME; else { TCHAR *str1 = TranslateTS(FAVMENUROOTNAME), *str2 = TranslateTS(rates[bContactRate]); - int bufsize = (mir_tstrlen(str1) + mir_tstrlen(str2) + 15) * sizeof(TCHAR); + size_t bufsize = (mir_tstrlen(str1) + mir_tstrlen(str2) + 15) * sizeof(TCHAR); TCHAR *name = (TCHAR *)_alloca(bufsize); - mir_sntprintf(name, bufsize / sizeof(TCHAR), _T("%s (%s)"), str1, str2); + mir_sntprintf(name, (bufsize / sizeof(TCHAR)), _T("%s (%s)"), str1, str2); mi.ptszName = name; mi.flags |= CMIF_KEEPUNTRANSLATED; } diff --git a/plugins/FTPFileYM/src/job_generic.cpp b/plugins/FTPFileYM/src/job_generic.cpp index 7035ee6703..e1d9947b71 100644 --- a/plugins/FTPFileYM/src/job_generic.cpp +++ b/plugins/FTPFileYM/src/job_generic.cpp @@ -46,7 +46,7 @@ GenericJob::~GenericJob() int GenericJob::openFileDialog() { TCHAR temp[MAX_PATH] = _T(""); - mir_sntprintf(temp, sizeof(temp), _T("%s\0*.*\0"), TranslateT("All Files (*.*)")); + mir_sntprintf(temp, SIZEOF(temp), _T("%s\0*.*\0"), TranslateT("All Files (*.*)")); OPENFILENAME ofn = {0}; ofn.lStructSize = sizeof(ofn); ofn.hwndOwner = 0; diff --git a/plugins/Nudge/src/main.cpp b/plugins/Nudge/src/main.cpp index db503b162a..6d460bc5f2 100644 --- a/plugins/Nudge/src/main.cpp +++ b/plugins/Nudge/src/main.cpp @@ -515,7 +515,7 @@ void Nudge_AddAccount(PROTOACCOUNT *proto) newNudge->item.hEvent = hevent; TCHAR soundDesc[MAXMODULELABELLENGTH + 10]; - mir_sntprintf(soundDesc, sizeof(soundDesc), LPGENT("Nudge for %s"), proto->tszAccountName); + mir_sntprintf(soundDesc, SIZEOF(soundDesc), LPGENT("Nudge for %s"), proto->tszAccountName); SkinAddNewSoundExT(newNudge->item.NudgeSoundname, LPGENT("Nudge"), soundDesc); newNudge->next = NudgeList; diff --git a/plugins/Nudge/src/options.cpp b/plugins/Nudge/src/options.cpp index 63fc12ad3a..0b3d1f695f 100644 --- a/plugins/Nudge/src/options.cpp +++ b/plugins/Nudge/src/options.cpp @@ -128,7 +128,7 @@ static INT_PTR CALLBACK DlgProcShakeOpt(HWND hwnd,UINT msg,WPARAM wParam,LPARAM { TCHAR szBuf[20]; DWORD dwPos = SendMessage((HWND)lParam, TBM_GETPOS, 0, 0); - mir_sntprintf(szBuf, sizeof(szBuf), _T("%d"), dwPos); + mir_sntprintf(szBuf, SIZEOF(szBuf), _T("%d"), dwPos); if ((HWND)lParam == GetDlgItem(hwnd, IDC_SNUMBER_CLIST)) SetDlgItemText(hwnd, IDC_LNUMBER_CLIST, szBuf); if ((HWND)lParam == GetDlgItem(hwnd, IDC_SNUMBER_CHAT)) diff --git a/plugins/Spamotron/src/spamotron.cpp b/plugins/Spamotron/src/spamotron.cpp index c37af43b12..dc7fe34e84 100644 --- a/plugins/Spamotron/src/spamotron.cpp +++ b/plugins/Spamotron/src/spamotron.cpp @@ -424,7 +424,7 @@ int OnDBEventFilterAdd(WPARAM wParam, LPARAM lParam) case SPAMOTRON_MODE_MATH: a = (rand() % 10) + 1; b = (rand() % 10) + 1; - mir_sntprintf(mexpr, sizeof(mexpr), _T("%d + %d"), a, b); + mir_sntprintf(mexpr, SIZEOF(mexpr), _T("%d + %d"), a, b); if (dbei->eventType == EVENTTYPE_AUTHREQUEST) _getOptS(challengeW, maxmsglen, "AuthChallengeMath", defaultAuthChallengeMath); else diff --git a/protocols/Gadu-Gadu/src/gg_proto.cpp b/protocols/Gadu-Gadu/src/gg_proto.cpp index 248f33e393..1f527f6bb5 100644 --- a/protocols/Gadu-Gadu/src/gg_proto.cpp +++ b/protocols/Gadu-Gadu/src/gg_proto.cpp @@ -482,7 +482,7 @@ HWND GGPROTO::SearchAdvanced(HWND hwndDlg) yearFrom = 0; else yearFrom = ay - yearFrom; - mir_sntprintf(text, sizeof(text), _T("%d %d"), yearFrom, yearTo); + mir_sntprintf(text, SIZEOF(text), _T("%d %d"), yearFrom, yearTo); char *age_utf8 = mir_utf8encodeT(text); gg_pubdir50_add(req, GG_PUBDIR50_BIRTHYEAR, age_utf8); diff --git a/protocols/IcqOscarJ/src/changeinfo/dlgproc.cpp b/protocols/IcqOscarJ/src/changeinfo/dlgproc.cpp index dff436cf78..3ee7618b02 100644 --- a/protocols/IcqOscarJ/src/changeinfo/dlgproc.cpp +++ b/protocols/IcqOscarJ/src/changeinfo/dlgproc.cpp @@ -475,7 +475,7 @@ INT_PTR CALLBACK ChangeInfoDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM for (done = 0, i = 0; i < SIZEOF(dat->hUpload); i++) done += dat->hUpload[i] == NULL; TCHAR buf[MAX_PATH]; - mir_sntprintf(buf, sizeof(buf), TranslateT("Upload in progress...%d%%"), 100 * done / (SIZEOF(dat->hUpload))); + mir_sntprintf(buf, SIZEOF(buf), TranslateT("Upload in progress...%d%%"), 100 * done / (SIZEOF(dat->hUpload))); SetDlgItemText(hwndDlg, IDC_UPLOADING, buf); if (done < SIZEOF(dat->hUpload)) break; diff --git a/src/modules/langpack/lpopts.cpp b/src/modules/langpack/lpopts.cpp index 7b960b6a40..1ecdf11e8e 100644 --- a/src/modules/langpack/lpopts.cpp +++ b/src/modules/langpack/lpopts.cpp @@ -77,7 +77,7 @@ static BOOL InsertPackItemEnumProc(LANGPACK_INFO *pack, WPARAM wParam, LPARAM lP /* insert */ TCHAR tszName[512]; - mir_sntprintf(tszName, sizeof(tszName), _T("%s [%s]"), + mir_sntprintf(tszName, SIZEOF(tszName), _T("%s [%s]"), TranslateTS(pack->tszLanguage), pack->flags & LPF_DEFAULT ? TranslateT("built-in") : pack->tszFileName); UINT message = pack->flags & LPF_DEFAULT ? CB_INSERTSTRING : CB_ADDSTRING; -- cgit v1.2.3