summaryrefslogtreecommitdiff
path: root/protocols/JabberG/src
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2014-09-22 14:57:06 +0000
committerGeorge Hazan <george.hazan@gmail.com>2014-09-22 14:57:06 +0000
commit97c3f6fe20b6474159beb924c6707bef481faa14 (patch)
tree874a46db938a12b54b88e04f6324e6fece8bb3de /protocols/JabberG/src
parentfc3a4607ee5cfe9e7cfed8d63e2cb1d549f61d92 (diff)
correct last _tcsncpy_s parameter's value
git-svn-id: http://svn.miranda-ng.org/main/trunk@10558 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols/JabberG/src')
-rw-r--r--protocols/JabberG/src/jabber.h4
-rw-r--r--protocols/JabberG/src/jabber_adhoc.cpp2
-rw-r--r--protocols/JabberG/src/jabber_caps.cpp2
-rw-r--r--protocols/JabberG/src/jabber_form.cpp2
-rw-r--r--protocols/JabberG/src/jabber_groupchat.cpp2
-rw-r--r--protocols/JabberG/src/jabber_iqid.cpp18
-rw-r--r--protocols/JabberG/src/jabber_password.cpp2
-rw-r--r--protocols/JabberG/src/jabber_proto.cpp6
-rw-r--r--protocols/JabberG/src/jabber_search.cpp6
-rw-r--r--protocols/JabberG/src/jabber_svc.cpp4
-rw-r--r--protocols/JabberG/src/jabber_thread.cpp9
-rw-r--r--protocols/JabberG/src/jabber_util.cpp2
12 files changed, 29 insertions, 30 deletions
diff --git a/protocols/JabberG/src/jabber.h b/protocols/JabberG/src/jabber.h
index 5c376b7599..a370de37f5 100644
--- a/protocols/JabberG/src/jabber.h
+++ b/protocols/JabberG/src/jabber.h
@@ -370,7 +370,7 @@ struct ThreadData
BOOL reg_done, bIsSessionAvailable;
class TJabberAuth* auth;
JabberCapsBits jabberServerCaps;
- BOOL bBookmarksLoaded;
+ BOOL bBookmarksLoaded;
DWORD dwLoginRqs;
// connection & login data
@@ -381,7 +381,7 @@ struct ThreadData
TCHAR resource[128];
TCHAR fullJID[JABBER_MAX_JID_LEN];
WORD port;
- TCHAR newPassword[512];
+ ptrT tszNewPassword;
void close(void);
void shutdown(void);
diff --git a/protocols/JabberG/src/jabber_adhoc.cpp b/protocols/JabberG/src/jabber_adhoc.cpp
index 6cb6f13f3c..6d28b2d30f 100644
--- a/protocols/JabberG/src/jabber_adhoc.cpp
+++ b/protocols/JabberG/src/jabber_adhoc.cpp
@@ -518,7 +518,7 @@ int __cdecl CJabberProto::ContactMenuRunCommands(WPARAM hContact, LPARAM lParam)
JABBER_LIST_ITEM *item = NULL;
int selected = 0;
TCHAR jid[JABBER_MAX_JID_LEN];
- _tcsncpy_s(jid, szJid, SIZEOF(jid));
+ _tcsncpy_s(jid, szJid, _TRUNCATE);
{
mir_cslock lck(m_csLists);
item = ListGetItemPtr(LIST_ROSTER, jid);
diff --git a/protocols/JabberG/src/jabber_caps.cpp b/protocols/JabberG/src/jabber_caps.cpp
index ce817df46c..22eba675e1 100644
--- a/protocols/JabberG/src/jabber_caps.cpp
+++ b/protocols/JabberG/src/jabber_caps.cpp
@@ -216,7 +216,7 @@ JabberCapsBits CJabberProto::GetResourceCapabilites(const TCHAR *jid, BOOL appen
if (appendBestResource)
GetClientJID(jid, fullJid, SIZEOF(fullJid));
else
- _tcsncpy_s(fullJid, jid, SIZEOF(fullJid));
+ _tcsncpy_s(fullJid, jid, _TRUNCATE);
pResourceStatus r(ResourceInfoFromJID(fullJid));
if (r == NULL)
diff --git a/protocols/JabberG/src/jabber_form.cpp b/protocols/JabberG/src/jabber_form.cpp
index 1efd935fa0..92e3e6f17f 100644
--- a/protocols/JabberG/src/jabber_form.cpp
+++ b/protocols/JabberG/src/jabber_form.cpp
@@ -868,7 +868,7 @@ void CJabberProto::FormCreateDialog(HXML xNode, TCHAR* defTitle, JABBER_FORM_SUB
jfi->ppro = this;
jfi->xNode = xi.copyNode(xNode);
if (defTitle)
- _tcsncpy_s(jfi->defTitle, defTitle, SIZEOF(jfi->defTitle));
+ _tcsncpy_s(jfi->defTitle, defTitle, _TRUNCATE);
jfi->pfnSubmit = pfnSubmit;
jfi->userdata = userdata;
diff --git a/protocols/JabberG/src/jabber_groupchat.cpp b/protocols/JabberG/src/jabber_groupchat.cpp
index 316f2f448e..85591044c2 100644
--- a/protocols/JabberG/src/jabber_groupchat.cpp
+++ b/protocols/JabberG/src/jabber_groupchat.cpp
@@ -1218,7 +1218,7 @@ void CJabberProto::GroupchatProcessInvite(const TCHAR *roomJid, const TCHAR *fro
void CJabberProto::AcceptGroupchatInvite(const TCHAR *roomJid, const TCHAR *reason, const TCHAR *password)
{
TCHAR room[256], *server, *p;
- _tcsncpy_s(room, roomJid, SIZEOF(room));
+ _tcsncpy_s(room, roomJid, _TRUNCATE);
p = _tcstok(room, _T("@"));
server = _tcstok(NULL, _T("@"));
GroupchatJoinRoom(server, p, reason, password);
diff --git a/protocols/JabberG/src/jabber_iqid.cpp b/protocols/JabberG/src/jabber_iqid.cpp
index 44cc13f28a..814e89c404 100644
--- a/protocols/JabberG/src/jabber_iqid.cpp
+++ b/protocols/JabberG/src/jabber_iqid.cpp
@@ -143,8 +143,8 @@ void CJabberProto::OnProcessLoginRq(ThreadData* info, DWORD rq)
TCHAR room[256], *server, *p;
TCHAR text[128];
- _tcsncpy_s(text, item->jid, SIZEOF(text));
- _tcsncpy_s(room, text, SIZEOF(room));
+ _tcsncpy_s(text, item->jid, _TRUNCATE);
+ _tcsncpy_s(room, text, _TRUNCATE);
p = _tcstok(room, _T("@"));
server = _tcstok(NULL, _T("@"));
if (item->nick && item->nick[0] != 0)
@@ -290,7 +290,7 @@ void CJabberProto::OnIqResultBind(HXML iqNode, CJabberIqInfo *pInfo)
debugLog(_T("Result Bind: %s confirmed "), m_ThreadInfo->fullJID);
else {
debugLog(_T("Result Bind: %s changed to %s"), m_ThreadInfo->fullJID, szJid);
- _tcsncpy_s(m_ThreadInfo->fullJID, szJid, SIZEOF(m_ThreadInfo->fullJID));
+ _tcsncpy_s(m_ThreadInfo->fullJID, szJid, _TRUNCATE);
}
}
if (m_ThreadInfo->bIsSessionAvailable)
@@ -682,7 +682,7 @@ void CJabberProto::OnIqResultGetVcard(HXML iqNode, CJabberIqInfo*)
jsr.hdr.firstName = sttGetText(vCardNode, "FN");
jsr.hdr.lastName = _T("");
jsr.hdr.email = sttGetText(vCardNode, "EMAIL");
- _tcsncpy_s(jsr.jid, jid, SIZEOF(jsr.jid));
+ _tcsncpy_s(jsr.jid, jid, _TRUNCATE);
jsr.jid[ SIZEOF(jsr.jid)-1 ] = '\0';
ProtoBroadcastAck(NULL, ACKTYPE_SEARCH, ACKRESULT_DATA, (HANDLE)id, (LPARAM)&jsr);
ProtoBroadcastAck(NULL, ACKTYPE_SEARCH, ACKRESULT_SUCCESS, (HANDLE)id, 0);
@@ -834,7 +834,7 @@ void CJabberProto::OnIqResultGetVcard(HXML iqNode, CJabberIqInfo*)
else if ((o=xmlGetChild(n, "EXTADD")) != NULL && xmlGetText(o) != NULL)
mir_sntprintf(text, SIZEOF(text), _T("%s\r\n%s"), xmlGetText(m), xmlGetText(o));
else
- _tcsncpy_s(text, xmlGetText(m), SIZEOF(text));
+ _tcsncpy_s(text, xmlGetText(m), _TRUNCATE);
text[SIZEOF(text)-1] = '\0';
setTString(hContact, "Street", text);
}
@@ -877,7 +877,7 @@ void CJabberProto::OnIqResultGetVcard(HXML iqNode, CJabberIqInfo*)
else if ((o=xmlGetChild(n, "EXTADD")) != NULL && xmlGetText(o) != NULL)
mir_sntprintf(text, SIZEOF(text), _T("%s\r\n%s"), xmlGetText(m), xmlGetText(o));
else
- _tcsncpy_s(text, xmlGetText(m), SIZEOF(text));
+ _tcsncpy_s(text, xmlGetText(m), _TRUNCATE);
text[SIZEOF(text)-1] = '\0';
setTString(hContact, "CompanyStreet", text);
}
@@ -1162,7 +1162,7 @@ void CJabberProto::OnIqResultSetSearch(HXML iqNode, CJabberIqInfo*)
if (!lstrcmp(xmlGetName(itemNode), _T("item"))) {
if ((jid = xmlGetAttrValue(itemNode, _T("jid"))) != NULL) {
- _tcsncpy_s(jsr.jid, jid, SIZEOF(jsr.jid));
+ _tcsncpy_s(jsr.jid, jid, _TRUNCATE);
jsr.jid[SIZEOF(jsr.jid) - 1] = '\0';
jsr.hdr.id = (TCHAR*)jid;
debugLog(_T("Result jid = %s"), jid);
@@ -1238,7 +1238,7 @@ void CJabberProto::OnIqResultExtSearch(HXML iqNode, CJabberIqInfo*)
continue;
if (!lstrcmp(fieldName, _T("jid"))) {
- _tcsncpy_s(jsr.jid, xmlGetText(n), SIZEOF(jsr.jid));
+ _tcsncpy_s(jsr.jid, xmlGetText(n), _TRUNCATE);
jsr.jid[SIZEOF(jsr.jid)-1] = '\0';
debugLog(_T("Result jid = %s"), jsr.jid);
}
@@ -1272,7 +1272,7 @@ void CJabberProto::OnIqResultSetPassword(HXML iqNode, CJabberIqInfo *pInfo)
return;
if (!lstrcmp(type, _T("result"))) {
- _tcsncpy_s(m_ThreadInfo->password, m_ThreadInfo->newPassword, SIZEOF(m_ThreadInfo->password));
+ _tcsncpy_s(m_ThreadInfo->password, m_ThreadInfo->tszNewPassword, _TRUNCATE);
MessageBox(NULL, TranslateT("Password is successfully changed. Don't forget to update your password in the Jabber protocol option."), TranslateT("Change Password"), MB_OK|MB_ICONINFORMATION|MB_SETFOREGROUND);
}
else if (!lstrcmp(type, _T("error")))
diff --git a/protocols/JabberG/src/jabber_password.cpp b/protocols/JabberG/src/jabber_password.cpp
index 95fd7cd7ea..a994f8bb7a 100644
--- a/protocols/JabberG/src/jabber_password.cpp
+++ b/protocols/JabberG/src/jabber_password.cpp
@@ -70,7 +70,7 @@ static INT_PTR CALLBACK JabberChangePasswordDlgProc(HWND hwndDlg, UINT msg, WPAR
MessageBox(hwndDlg, TranslateT("Current password is incorrect."), TranslateT("Change Password"), MB_OK|MB_ICONSTOP|MB_SETFOREGROUND);
break;
}
- _tcsncpy_s(ppro->m_ThreadInfo->newPassword, newPasswd, SIZEOF(ppro->m_ThreadInfo->newPassword));
+ ppro->m_ThreadInfo->tszNewPassword = mir_tstrdup(newPasswd);
XmlNodeIq iq( ppro->AddIQ(&CJabberProto::OnIqResultSetPassword, JABBER_IQ_TYPE_SET, _A2T(ppro->m_ThreadInfo->server)));
HXML q = iq << XQUERY(JABBER_FEAT_REGISTER);
diff --git a/protocols/JabberG/src/jabber_proto.cpp b/protocols/JabberG/src/jabber_proto.cpp
index 86bb347cd4..117ae4d242 100644
--- a/protocols/JabberG/src/jabber_proto.cpp
+++ b/protocols/JabberG/src/jabber_proto.cpp
@@ -720,7 +720,7 @@ void __cdecl CJabberProto::BasicSearchThread(JABBER_SEARCH_BASIC *jsb)
jsr.hdr.lastName = _T("");
jsr.hdr.id = jsb->jid;
- _tcsncpy_s(jsr.jid, jsb->jid, SIZEOF(jsr.jid));
+ _tcsncpy_s(jsr.jid, jsb->jid, _TRUNCATE);
jsr.jid[SIZEOF(jsr.jid)-1] = '\0';
ProtoBroadcastAck(NULL, ACKTYPE_SEARCH, ACKRESULT_DATA, (HANDLE)jsb->hSearch, (LPARAM)&jsr);
@@ -754,10 +754,10 @@ HANDLE __cdecl CJabberProto::SearchBasic(const TCHAR *szJid)
}
mir_sntprintf(jsb->jid, SIZEOF(jsb->jid), _T("%s@%s"), szJid, szServer);
}
- else _tcsncpy_s(jsb->jid, szJid, SIZEOF(jsb->jid));
+ else _tcsncpy_s(jsb->jid, szJid, _TRUNCATE);
mir_free(szServer);
}
- else _tcsncpy_s(jsb->jid, szJid, SIZEOF(jsb->jid));
+ else _tcsncpy_s(jsb->jid, szJid, _TRUNCATE);
debugLog(_T("Adding '%s' without validation"), jsb->jid);
jsb->hSearch = SerialNext();
diff --git a/protocols/JabberG/src/jabber_search.cpp b/protocols/JabberG/src/jabber_search.cpp
index 177bc5e70c..78e2feaabb 100644
--- a/protocols/JabberG/src/jabber_search.cpp
+++ b/protocols/JabberG/src/jabber_search.cpp
@@ -251,7 +251,7 @@ void CJabberProto::SearchReturnResults(HANDLE id, void * pvUsersInfo, U_TCHAR_M
Results.jsr.hdr.cbSize = sizeof(Results.jsr); // sending user data
for (i=0; i < nUsersFound; i++) {
- TCHAR buff[200]=_T("");
+ TCHAR buff[200]; buff[0] = 0;
Results.jsr.jid[0]=0;
U_TCHAR_MAP * pmUserData = (U_TCHAR_MAP *) plUsersInfo->operator [](i);
for (int j=0; j < nFieldCount; j++) {
@@ -259,7 +259,7 @@ void CJabberProto::SearchReturnResults(HANDLE id, void * pvUsersInfo, U_TCHAR_M
TCHAR* value = pmUserData->operator [](var);
Results.pszFields[j] = value ? value : (TCHAR *)_T(" ");
if (!_tcsicmp(var,_T("jid")) && value)
- _tcsncpy_s(Results.jsr.jid, value, SIZEOF(Results.jsr.jid));
+ _tcsncpy_s(Results.jsr.jid, value, _TRUNCATE);
}
{
TCHAR * nickfields[]={ _T("nick"), _T("nickname"),
@@ -272,7 +272,7 @@ void CJabberProto::SearchReturnResults(HANDLE id, void * pvUsersInfo, U_TCHAR_M
if (_tcsicmp(nick, Results.jsr.jid))
mir_sntprintf(buff, SIZEOF(buff), _T("%s (%s)"), nick, Results.jsr.jid);
else
- _tcsncpy_s(buff, nick, SIZEOF(buff));
+ _tcsncpy_s(buff, nick, _TRUNCATE);
Results.jsr.hdr.nick = nick ? buff : NULL;
Results.jsr.hdr.flags = PSR_TCHAR;
}
diff --git a/protocols/JabberG/src/jabber_svc.cpp b/protocols/JabberG/src/jabber_svc.cpp
index 81d6d37671..f35fcbda5b 100644
--- a/protocols/JabberG/src/jabber_svc.cpp
+++ b/protocols/JabberG/src/jabber_svc.cpp
@@ -131,7 +131,7 @@ INT_PTR __cdecl CJabberProto::JabberGetAvatarInfo(WPARAM wParam, LPARAM lParam)
TCHAR tszFileName[MAX_PATH];
GetAvatarFileName(AI->hContact, tszFileName, SIZEOF(tszFileName));
- _tcsncpy_s(AI->filename, tszFileName, SIZEOF(AI->filename));
+ _tcsncpy_s(AI->filename, tszFileName, _TRUNCATE);
AI->format = (AI->hContact == NULL) ? PA_FORMAT_PNG : getByte(AI->hContact, "AvatarType", 0);
@@ -469,7 +469,7 @@ INT_PTR __cdecl CJabberProto::JabberServiceParseXmppURI(WPARAM, LPARAM lParam)
jsr.hdr.flags = PSR_TCHAR;
jsr.hdr.nick = szJid;
jsr.hdr.id = szJid;
- _tcsncpy_s(jsr.jid, szJid, SIZEOF(jsr.jid) - 1);
+ _tcsncpy_s(jsr.jid, szJid, _TRUNCATE);
ADDCONTACTSTRUCT acs;
acs.handleType = HANDLE_SEARCHRESULT;
diff --git a/protocols/JabberG/src/jabber_thread.cpp b/protocols/JabberG/src/jabber_thread.cpp
index 70a61cf5fb..4e5bf1b4f9 100644
--- a/protocols/JabberG/src/jabber_thread.cpp
+++ b/protocols/JabberG/src/jabber_thread.cpp
@@ -304,13 +304,13 @@ LBL_FatalError:
TCHAR jidStr[512];
mir_sntprintf(jidStr, SIZEOF(jidStr), _T("%s@%S/%s"), info->username, info->server, info->resource);
- _tcsncpy_s(info->fullJID, jidStr, SIZEOF(info->fullJID)-1);
+ _tcsncpy_s(info->fullJID, jidStr, _TRUNCATE);
if (m_options.UseDomainLogin) // in the case of NTLM auth we have no need in password
info->password[0] = 0;
else if (!m_options.SavePassword) { // we have to enter a password manually. have we done it before?
if (m_savedPassword != NULL)
- _tcsncpy_s(info->password, SIZEOF(info->password), m_savedPassword, _TRUNCATE);
+ _tcsncpy_s(info->password, m_savedPassword, _TRUNCATE);
else {
mir_sntprintf(jidStr, SIZEOF(jidStr), _T("%s@%S"), info->username, info->server);
@@ -329,7 +329,7 @@ LBL_FatalError:
}
m_savedPassword = (param.saveOnlinePassword) ? mir_tstrdup(param.onlinePassword) : NULL;
- _tcsncpy_s(info->password, SIZEOF(info->password), param.onlinePassword, _TRUNCATE);
+ _tcsncpy_s(info->password, param.onlinePassword, _TRUNCATE);
}
}
else {
@@ -339,10 +339,9 @@ LBL_FatalError:
debugLogA("Thread ended, password is not configured");
goto LBL_FatalError;
}
- _tcsncpy_s(info->password, SIZEOF(info->password), tszPassw, _TRUNCATE);
+ _tcsncpy_s(info->password, tszPassw, _TRUNCATE);
}
}
-
else if (info->type == JABBER_SESSION_REGISTER) {
// Register new user connection, all connection parameters are already filled-in.
// Multiple thread allowed, although not possible :)
diff --git a/protocols/JabberG/src/jabber_util.cpp b/protocols/JabberG/src/jabber_util.cpp
index e87634e657..2b37a1c864 100644
--- a/protocols/JabberG/src/jabber_util.cpp
+++ b/protocols/JabberG/src/jabber_util.cpp
@@ -1135,7 +1135,7 @@ void __cdecl CJabberProto::LoadHttpAvatars(void* param)
if (cmpsha == NULL || strnicmp(cmpsha, buffer, sizeof(buffer))) {
TCHAR tszFileName[MAX_PATH];
GetAvatarFileName(AI.hContact, tszFileName, SIZEOF(tszFileName));
- _tcsncpy_s(AI.filename, tszFileName, SIZEOF(AI.filename));
+ _tcsncpy_s(AI.filename, tszFileName, _TRUNCATE);
FILE* out = _tfopen(tszFileName, _T("wb"));
if (out != NULL) {
fwrite(res->pData, res->dataLength, 1, out);