summaryrefslogtreecommitdiff
path: root/protocols
diff options
context:
space:
mode:
authorRozhuk Ivan <rozhuk.im@gmail.com>2014-12-02 05:19:23 +0000
committerRozhuk Ivan <rozhuk.im@gmail.com>2014-12-02 05:19:23 +0000
commit114f83d5d8a73b3f1435e09b1d91aff843e4ce15 (patch)
tree0805188bf6bcf5749d1e76d5d1e73ccb6cf41cc4 /protocols
parent6e2b6b31bae6d69bff5271451e73eb08637b8118 (diff)
mir_snprintf(..., "%s", ...) -> strncpy_s(...)
build fix to prevous commit git-svn-id: http://svn.miranda-ng.org/main/trunk@11212 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols')
-rw-r--r--protocols/Dummy/src/dummy_proto.cpp4
-rw-r--r--protocols/IRCG/src/commandmonitor.cpp4
-rw-r--r--protocols/IcqOscarJ/src/UI/userinfotab.cpp5
-rw-r--r--protocols/MSN/src/msn_misc.cpp2
-rw-r--r--protocols/MSN/src/msn_opts.cpp2
-rw-r--r--protocols/MSN/src/msn_p2p.cpp2
-rw-r--r--protocols/MSN/src/msn_soapab.cpp4
-rw-r--r--protocols/MSN/src/msn_soapstore.cpp8
-rw-r--r--protocols/Tlen/src/tlen.cpp6
-rw-r--r--protocols/Tlen/src/tlen_file.cpp4
-rw-r--r--protocols/Tlen/src/tlen_iqid.cpp6
-rw-r--r--protocols/Tlen/src/tlen_muc.cpp2
-rw-r--r--protocols/Tlen/src/tlen_thread.cpp2
-rw-r--r--protocols/Xfire/src/Xfire_base.cpp2
-rw-r--r--protocols/Yahoo/src/yahoo.cpp18
15 files changed, 33 insertions, 38 deletions
diff --git a/protocols/Dummy/src/dummy_proto.cpp b/protocols/Dummy/src/dummy_proto.cpp
index 4343018c35..72819d962b 100644
--- a/protocols/Dummy/src/dummy_proto.cpp
+++ b/protocols/Dummy/src/dummy_proto.cpp
@@ -75,7 +75,7 @@ DWORD_PTR CDummyProto::GetCaps(int type, MCONTACT hContact)
if (uniqueIdSetting[0] == '\0') {
ptrA setting(getStringA(DUMMY_ID_TEXT));
if (setting != NULL)
- mir_snprintf(uniqueIdSetting, SIZEOF(uniqueIdSetting), "%s", setting);
+ strncpy_s(uniqueIdSetting, setting, _TRUNCATE);
}
return (DWORD_PTR)uniqueIdSetting;
@@ -83,7 +83,7 @@ DWORD_PTR CDummyProto::GetCaps(int type, MCONTACT hContact)
if (uniqueIdText[0] == '\0') {
ptrA setting(getStringA(DUMMY_ID_SETTING));
if (setting != NULL)
- mir_snprintf(uniqueIdText, SIZEOF(uniqueIdText), "%s", setting);
+ strncpy_s(uniqueIdText, setting, _TRUNCATE);
}
return (DWORD_PTR)uniqueIdText;
}
diff --git a/protocols/IRCG/src/commandmonitor.cpp b/protocols/IRCG/src/commandmonitor.cpp
index d70529a159..a96cd06395 100644
--- a/protocols/IRCG/src/commandmonitor.cpp
+++ b/protocols/IRCG/src/commandmonitor.cpp
@@ -246,9 +246,9 @@ void __cdecl CIrcProto::ResolveIPThread(LPVOID di)
IN_ADDR in;
memcpy(&in, myhost->h_addr, 4);
if (ipr->iType == IP_AUTO)
- mir_snprintf(m_myHost, SIZEOF(m_myHost), "%s", inet_ntoa(in));
+ strncpy_s(m_myHost, inet_ntoa(in), _TRUNCATE);
else
- mir_snprintf(m_mySpecifiedHostIP, SIZEOF(m_mySpecifiedHostIP), "%s", inet_ntoa(in));
+ strncpy_s(m_mySpecifiedHostIP, inet_ntoa(in), _TRUNCATE);
}
}
}
diff --git a/protocols/IcqOscarJ/src/UI/userinfotab.cpp b/protocols/IcqOscarJ/src/UI/userinfotab.cpp
index 3dbdbdbd2f..4808b0ef7e 100644
--- a/protocols/IcqOscarJ/src/UI/userinfotab.cpp
+++ b/protocols/IcqOscarJ/src/UI/userinfotab.cpp
@@ -117,9 +117,8 @@ static void SetValue(CIcqProto* ppro, HWND hwndDlg, int idCtrl, MCONTACT hContac
}
mir_snprintf(str, SIZEOF(str), "%s (%s)", pszStatus, pXName);
SAFE_FREE((void**)&pXName);
- }
- else
- mir_snprintf(str, SIZEOF(str), "%s", pszStatus);
+ } else
+ strncpy_s(str, pszStatus, _TRUNCATE);
bUtf = 1;
SAFE_FREE(&pszStatus);
diff --git a/protocols/MSN/src/msn_misc.cpp b/protocols/MSN/src/msn_misc.cpp
index 74458df7bd..b04aad206f 100644
--- a/protocols/MSN/src/msn_misc.cpp
+++ b/protocols/MSN/src/msn_misc.cpp
@@ -663,7 +663,7 @@ int ThreadData::sendPacket(const char* cmd, const char* fmt, ...)
int thisTrid = 0;
if (fmt == NULL)
- mir_snprintf(str, strsize, "%s", cmd);
+ strncpy_s(str, strsize, cmd, _TRUNCATE);
else {
thisTrid = InterlockedIncrement(&mTrid);
if (fmt[0] == '\0')
diff --git a/protocols/MSN/src/msn_opts.cpp b/protocols/MSN/src/msn_opts.cpp
index f0653b83b0..9026ff912e 100644
--- a/protocols/MSN/src/msn_opts.cpp
+++ b/protocols/MSN/src/msn_opts.cpp
@@ -329,7 +329,7 @@ static INT_PTR CALLBACK DlgProcMsnConnOpts(HWND hwndDlg, UINT msg, WPARAM wParam
gethst = 0;
if (gethst == 0)
- mir_snprintf(ipaddr, SIZEOF(ipaddr), "%s", proto->msnLoggedIn ? proto->MyConnection.GetMyExtIPStr() : "");
+ strncpy_s(ipaddr, (proto->msnLoggedIn ? proto->MyConnection.GetMyExtIPStr() : ""), _TRUNCATE);
SendDlgItemMessage(hwndDlg, IDC_HOSTOPT, CB_SETCURSEL, gethst, 0);
if (ipaddr[0])
diff --git a/protocols/MSN/src/msn_p2p.cpp b/protocols/MSN/src/msn_p2p.cpp
index a6cb19e8e0..345a081f35 100644
--- a/protocols/MSN/src/msn_p2p.cpp
+++ b/protocols/MSN/src/msn_p2p.cpp
@@ -1398,7 +1398,7 @@ void CMsnProto::p2p_startConnect(const char* wlid, const char* szCallID, const c
newThread->mType = SERVER_P2P_DIRECT;
newThread->mInitialContactWLID = mir_strdup(wlid);
- mir_snprintf(newThread->mCookie, SIZEOF(newThread->mCookie), "%s", szCallID);
+ strncpy_s(newThread->mCookie, szCallID, _TRUNCATE);
mir_snprintf(newThread->mServer, SIZEOF(newThread->mServer),
ipv6 ? "[%s]:%s" : "%s:%s", pAddrTokBeg, pPortTokBeg);
diff --git a/protocols/MSN/src/msn_soapab.cpp b/protocols/MSN/src/msn_soapab.cpp
index 22b92fe25b..88acf26373 100644
--- a/protocols/MSN/src/msn_soapab.cpp
+++ b/protocols/MSN/src/msn_soapab.cpp
@@ -637,8 +637,8 @@ bool CMsnProto::MSN_ABFind(const char* szMethod, const char* szGuid, bool deltas
}
ezxml_t abinf = ezxml_child(ab, "abInfo");
- mir_snprintf(mycid, SIZEOF(mycid), "%s", ezxml_txt(ezxml_child(abinf, "OwnerCID")));
- mir_snprintf(mypuid, SIZEOF(mypuid), "%s", ezxml_txt(ezxml_child(abinf, "ownerPuid")));
+ strncpy_s(mycid, ezxml_txt(ezxml_child(abinf, "OwnerCID")), _TRUNCATE);
+ strncpy_s(mypuid, ezxml_txt(ezxml_child(abinf, "ownerPuid")), _TRUNCATE);
if (MyOptions.ManageServer) {
ezxml_t grp = ezxml_get(body, szGroups, 0, "Group", -1);
diff --git a/protocols/MSN/src/msn_soapstore.cpp b/protocols/MSN/src/msn_soapstore.cpp
index 1028e403cc..ccec429d07 100644
--- a/protocols/MSN/src/msn_soapstore.cpp
+++ b/protocols/MSN/src/msn_soapstore.cpp
@@ -257,7 +257,7 @@ bool CMsnProto::MSN_StoreGetProfile(bool allowRecurse)
UpdateStoreHost("GetProfile", body ? storeUrl : NULL);
- mir_snprintf(proresid, SIZEOF(proresid), "%s", ezxml_txt(ezxml_child(body, "ResourceID")));
+ strncpy_s(proresid, ezxml_txt(ezxml_child(body, "ResourceID")), _TRUNCATE);
ezxml_t expr = ezxml_child(body, "ExpressionProfile");
if (expr == NULL) {
@@ -272,10 +272,10 @@ bool CMsnProto::MSN_StoreGetProfile(bool allowRecurse)
const char* szStatus = ezxml_txt(ezxml_child(expr, "PersonalStatus"));
replaceStr(msnLastStatusMsg, szStatus);
- mir_snprintf(expresid, SIZEOF(expresid), "%s", ezxml_txt(ezxml_child(expr, "ResourceID")));
+ strncpy_s(expresid, ezxml_txt(ezxml_child(expr, "ResourceID")), _TRUNCATE);
ezxml_t photo = ezxml_child(expr, "Photo");
- mir_snprintf(photoid, SIZEOF(photoid), "%s", ezxml_txt(ezxml_child(photo, "ResourceID")));
+ strncpy_s(photoid, ezxml_txt(ezxml_child(photo, "ResourceID")), _TRUNCATE);
ezxml_t docstr = ezxml_get(photo, "DocumentStreams", 0, "DocumentStream", -1);
while (docstr) {
@@ -565,7 +565,7 @@ bool CMsnProto::MSN_StoreCreateDocument(const TCHAR *sztName, const char *szMime
if (status == 200) {
ezxml_t xmlm = ezxml_parse_str(tResult, strlen(tResult));
ezxml_t bdy = getSoapResponse(xmlm, "CreateDocument");
- mir_snprintf(photoid, SIZEOF(photoid), "%s", ezxml_txt(bdy));
+ strncpy_s(photoid, ezxml_txt(bdy), _TRUNCATE);
ezxml_free(xmlm);
}
else if (status == 500) {
diff --git a/protocols/Tlen/src/tlen.cpp b/protocols/Tlen/src/tlen.cpp
index 38249081ca..81ef9b9d2e 100644
--- a/protocols/Tlen/src/tlen.cpp
+++ b/protocols/Tlen/src/tlen.cpp
@@ -239,11 +239,11 @@ int TlenProtocol::OnModulesLoaded(WPARAM wParam, LPARAM lParam)
if (db_get_w(hContact, m_szModuleName, "Status", ID_STATUS_OFFLINE) != ID_STATUS_OFFLINE)
db_set_w(hContact, m_szModuleName, "Status", ID_STATUS_OFFLINE);
- mir_snprintf(str, SIZEOF(str), "%s", LPGEN("Incoming mail"));
+ strncpy_s(str, LPGEN("Incoming mail"), _TRUNCATE);
SkinAddNewSoundEx("TlenMailNotify", m_szModuleName, str);
- mir_snprintf(str, SIZEOF(str), "%s", LPGEN("Alert"));
+ strncpy_s(str, LPGEN("Alert"), _TRUNCATE);
SkinAddNewSoundEx("TlenAlertNotify", m_szModuleName, str);
- mir_snprintf(str, SIZEOF(str), "%s", LPGEN("Voice chat"));
+ strncpy_s(str, LPGEN("Voice chat"), _TRUNCATE);
SkinAddNewSoundEx("TlenVoiceNotify", m_szModuleName, str);
HookProtoEvent(ME_USERINFO_INITIALISE, &TlenProtocol::UserInfoInit);
diff --git a/protocols/Tlen/src/tlen_file.cpp b/protocols/Tlen/src/tlen_file.cpp
index b0460c24a6..ef073b9ec2 100644
--- a/protocols/Tlen/src/tlen_file.cpp
+++ b/protocols/Tlen/src/tlen_file.cpp
@@ -276,7 +276,7 @@ static void TlenFileSendParse(TLEN_FILE_TRANSFER *ft)
t++;
else
t = ft->files[i];
- mir_snprintf(filename, (SIZEOF(filename) - 1), "%s", t);
+ strncpy_s(filename, t, _TRUNCATE);
TlenP2PPacketPackBuffer(packet, filename, sizeof(filename));
}
TlenP2PPacketSend(ft->s, packet);
@@ -572,7 +572,7 @@ void TlenProcessF(XmlNode *node, ThreadData *info)
if (strchr(from, '@') == NULL) {
mir_snprintf(jid, SIZEOF(jid), "%s@%s", from, info->server);
} else {
- mir_snprintf(jid, SIZEOF(jid), "%s", from);
+ strncpy_s(jid, from, _TRUNCATE);
}
if ((e=TlenXmlGetAttrValue(node, "e")) != NULL) {
diff --git a/protocols/Tlen/src/tlen_iqid.cpp b/protocols/Tlen/src/tlen_iqid.cpp
index f041d712ca..a03d1a7614 100644
--- a/protocols/Tlen/src/tlen_iqid.cpp
+++ b/protocols/Tlen/src/tlen_iqid.cpp
@@ -257,7 +257,7 @@ void TlenIqResultVcard(TlenProtocol *proto, XmlNode *iqNode)
if ((jid=TlenXmlGetAttrValue(itemNode, "jid")) != NULL) {
if (db_get(NULL, proto->m_szModuleName, "LoginServer", &dbv)) return;
if (strchr(jid, '@') != NULL) {
- mir_snprintf(text, SIZEOF(text), "%s", jid);
+ strncpy_s(text, jid, _TRUNCATE);
} else {
mir_snprintf(text, SIZEOF(text), "%s@%s", jid, dbv.pszVal); // Add @tlen.pl
}
@@ -419,7 +419,7 @@ void TlenIqResultSearch(TlenProtocol *proto, XmlNode *iqNode)
if (!strcmp(itemNode->name, "item")) {
if ((jid=TlenXmlGetAttrValue(itemNode, "jid")) != NULL) {
if (strchr(jid, '@') != NULL) {
- mir_snprintf(jsr.jid, SIZEOF(jsr.jid), "%s", jid);
+ strncpy_s(jsr.jid, jid, _TRUNCATE);
} else {
mir_snprintf(jsr.jid, SIZEOF(jsr.jid), "%s@%s", jid, dbv.pszVal);
}
@@ -467,7 +467,7 @@ void TlenIqResultSearch(TlenProtocol *proto, XmlNode *iqNode)
if (proto->searchJID != NULL) {
if (!found) {
if (strchr(proto->searchJID, '@') != NULL) {
- mir_snprintf(jsr.jid, SIZEOF(jsr.jid), "%s", proto->searchJID);
+ strncpy_s(jsr.jid, proto->searchJID, _TRUNCATE);
} else {
mir_snprintf(jsr.jid, SIZEOF(jsr.jid), "%s@%s", proto->searchJID, dbv.pszVal);
}
diff --git a/protocols/Tlen/src/tlen_muc.cpp b/protocols/Tlen/src/tlen_muc.cpp
index 0f406d9c77..9712af7339 100644
--- a/protocols/Tlen/src/tlen_muc.cpp
+++ b/protocols/Tlen/src/tlen_muc.cpp
@@ -154,7 +154,7 @@ static int TlenMUCSendPresence(TlenProtocol *proto, const char *roomID, const ch
if (nick != NULL) {
mir_snprintf(str, SIZEOF(str), "%s/%s", roomID, nick);
} else {
- mir_snprintf(str, SIZEOF(str), "%s", roomID);
+ strncpy_s(str, roomID, _TRUNCATE);
}
if ((jid = TlenTextEncode(str)) != NULL) {
switch (desiredStatus) {
diff --git a/protocols/Tlen/src/tlen_thread.cpp b/protocols/Tlen/src/tlen_thread.cpp
index c243fa11ec..9f714bbdb6 100644
--- a/protocols/Tlen/src/tlen_thread.cpp
+++ b/protocols/Tlen/src/tlen_thread.cpp
@@ -1190,7 +1190,7 @@ static void TlenProcessV(XmlNode *node, ThreadData *info)
if (strchr(from, '@') == NULL) {
mir_snprintf(jid, SIZEOF(jid), "%s@%s", from, info->server);
} else {
- mir_snprintf(jid, SIZEOF(jid), "%s", from);
+ strncpy_s(jid, from, _TRUNCATE);
}
if ((e=TlenXmlGetAttrValue(node, "e")) != NULL) {
if (!strcmp(e, "1")) {
diff --git a/protocols/Xfire/src/Xfire_base.cpp b/protocols/Xfire/src/Xfire_base.cpp
index 6363c0e0dd..602a198997 100644
--- a/protocols/Xfire/src/Xfire_base.cpp
+++ b/protocols/Xfire/src/Xfire_base.cpp
@@ -524,7 +524,7 @@ BOOL Xfire_base::getGamename(unsigned int gameid, char* out, int outsize){
char dbstr[80] = "";
mir_snprintf(dbstr, XFIRE_MAXSIZEOFGAMENAME, "customgamename_%d", gameid);
if (!db_get(NULL, protocolname, dbstr, &dbv)) {
- mir_snprintf(out, outsize, "%s", dbv.pszVal);
+ strncpy_s(out, outsize, dbv.pszVal, _TRUNCATE);
db_free(&dbv);
return TRUE;
}
diff --git a/protocols/Yahoo/src/yahoo.cpp b/protocols/Yahoo/src/yahoo.cpp
index 44e313320e..eb920fe9ba 100644
--- a/protocols/Yahoo/src/yahoo.cpp
+++ b/protocols/Yahoo/src/yahoo.cpp
@@ -794,12 +794,12 @@ void CYahooProto::ext_contact_added(const char *myid, const char *who, const cha
if (lname && fname)
mir_snprintf(nick, SIZEOF(nick), "%s %s", fname, lname);
else if (lname)
- mir_snprintf(nick, SIZEOF(nick), "%s", lname);
+ strncpy_s(nick, lname, _TRUNCATE);
else if (fname)
- mir_snprintf(nick, SIZEOF(nick), "%s", fname);
+ strncpy_s(nick, fname, _TRUNCATE);
- if (nick[0] == '\0')
- mir_snprintf(nick, SIZEOF(nick), "%s", who);
+ if (nick[0] == '\0')
+ strncpy_s(nick, who, _TRUNCATE);
if (fname) SetStringUtf(hContact, "FirstName", fname);
if (lname) SetStringUtf(hContact, "LastName", lname);
@@ -1546,14 +1546,10 @@ void CYahooProto::ext_login(enum yahoo_status login_mode)
if (host[0] == '\0') {
if (!getString(YAHOO_LOGINSERVER, &dbv)) {
- mir_snprintf(host, SIZEOF(host), "%s", dbv.pszVal);
+ strncpy_s(host, dbv.pszVal, _TRUNCATE);
db_free(&dbv);
- }
- else {
- mir_snprintf(host, SIZEOF(host), "%s",
- getByte("YahooJapan",0) != 0 ? YAHOO_DEFAULT_JAPAN_LOGIN_SERVER :
- YAHOO_DEFAULT_LOGIN_SERVER
- );
+ } else {
+ strncpy_s(host, (getByte("YahooJapan",0) ? YAHOO_DEFAULT_JAPAN_LOGIN_SERVER : YAHOO_DEFAULT_LOGIN_SERVER), _TRUNCATE);
}
}