summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2015-05-14 19:05:32 +0000
committerGeorge Hazan <george.hazan@gmail.com>2015-05-14 19:05:32 +0000
commit2a884a193239118e9ff76d7a29dae5a84fab1122 (patch)
tree3841609097524f26548e9b9c0157e6891ee5247d
parentf4048a55be034634434050cfa7748aa9f5d18126 (diff)
- crash fix;
- code cleaning git-svn-id: http://svn.miranda-ng.org/main/trunk@13594 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
-rw-r--r--protocols/MSN/src/msn_auth.cpp2
-rw-r--r--protocols/MSN/src/msn_misc.cpp5
-rw-r--r--protocols/MSN/src/msn_proto.h14
-rw-r--r--protocols/MSN/src/msn_threads.cpp26
4 files changed, 23 insertions, 24 deletions
diff --git a/protocols/MSN/src/msn_auth.cpp b/protocols/MSN/src/msn_auth.cpp
index cfb1e5291a..14f2b06ec5 100644
--- a/protocols/MSN/src/msn_auth.cpp
+++ b/protocols/MSN/src/msn_auth.cpp
@@ -705,7 +705,7 @@ int CMsnProto::MSN_AuthOAuth(void)
if (!authTokenExpiretime) LoadAuthTokensDB();
// Is there already a valid token and we can skip this?
- if (time(&t)+10 < authTokenExpiretime && !strcmp(authUser, MyOptions.szEmail)) return authMethod;
+ if (time(&t)+10 < authTokenExpiretime && !mir_strcmp(authUser, MyOptions.szEmail)) return authMethod;
// initialize the netlib request
nlhr.cbSize = sizeof(nlhr);
diff --git a/protocols/MSN/src/msn_misc.cpp b/protocols/MSN/src/msn_misc.cpp
index 1b2d956dc3..eee9746688 100644
--- a/protocols/MSN/src/msn_misc.cpp
+++ b/protocols/MSN/src/msn_misc.cpp
@@ -603,8 +603,7 @@ void CMsnProto::MSN_SendStatusMessage(const char* msg)
if (!msnLoggedIn)
return;
- /* FIXME: Currently not implemented, shuold be set on status change anyway */
- return;
+ /* FIXME: Currently not implemented, shuold be set on status change anyway
char* msgEnc = HtmlEncode(msg ? msg : "");
@@ -673,7 +672,7 @@ void CMsnProto::MSN_SendStatusMessage(const char* msg)
replaceStr(msnPreviousUUX, szMsg);
msnNsThread->sendPacket("UUX", "%d\r\n%s", sz, szMsg);
mStatusMsgTS = clock();
- }
+ } */
}
/////////////////////////////////////////////////////////////////////////////////////////
diff --git a/protocols/MSN/src/msn_proto.h b/protocols/MSN/src/msn_proto.h
index 89791e86de..adbbab1a57 100644
--- a/protocols/MSN/src/msn_proto.h
+++ b/protocols/MSN/src/msn_proto.h
@@ -474,18 +474,18 @@ struct CMsnProto : public PROTO<CMsnProto>
// MSN Authentication
int MSN_GetPassportAuth(void);
- int MSN_SkypeAuth(const char *pszNonce, char *pszUIC);
- int MSN_DoOAuth(void);
- char* GenerateLoginBlob(char* challenge);
+ int MSN_SkypeAuth(const char *pszNonce, char *pszUIC);
+ int MSN_DoOAuth(void);
+ char* GenerateLoginBlob(char* challenge);
void LoadAuthTokensDB(void);
void SaveAuthTokensDB(void);
- int LoginSkypeOAuth(const char *pRefreshToken);
+ int LoginSkypeOAuth(const char *pRefreshToken);
bool RefreshOAuth(const char *pszRefreshToken, const char *pszService, char *pszAccessToken, char *pszOutRefreshToken=NULL, time_t *ptExpires=NULL);
- int MSN_AuthOAuth(void);
+ int MSN_AuthOAuth(void);
CMStringA HotmailLogin(const char* url);
void FreeAuthTokens(void);
- int GetMyNetID(void);
- const char *GetMyUsername(int netId);
+ int GetMyNetID(void);
+ LPCSTR GetMyUsername(int netId);
/////////////////////////////////////////////////////////////////////////////////////////
// MSN avatars support
diff --git a/protocols/MSN/src/msn_threads.cpp b/protocols/MSN/src/msn_threads.cpp
index 34c446d3e6..208d8e1287 100644
--- a/protocols/MSN/src/msn_threads.cpp
+++ b/protocols/MSN/src/msn_threads.cpp
@@ -72,18 +72,18 @@ void __cdecl CMsnProto::msn_keepAliveThread(void*)
/////////////////////////////////////////////////////////////////////////////////////////
// MSN server thread - read and process commands from a server
-static bool ReallocInfoBuffer(ThreadData *info, int mDataSize)
+
+static bool ReallocInfoBuffer(ThreadData *info, size_t mDataSize)
{
char *mData = (char*)mir_realloc(info->mData, mDataSize+1);
- if (mData) {
- info->mData = mData;
- info->mDataSize = mDataSize;
- ZeroMemory(&mData[info->mBytesInData], info->mDataSize-info->mBytesInData+1);
- return true;
- }
- return false;
-}
+ if (mData == NULL)
+ return false;
+ info->mData = mData;
+ info->mDataSize = mDataSize;
+ ZeroMemory(&mData[info->mBytesInData], info->mDataSize-info->mBytesInData+1);
+ return true;
+}
void __cdecl CMsnProto::MSNServerThread(void* arg)
{
@@ -202,18 +202,18 @@ void __cdecl CMsnProto::MSNServerThread(void* arg)
if (peol == NULL)
break;
- if (info->mBytesInData < peol - info->mData + 2)
+ int msgLen = (int)(peol - info->mData);
+ if (info->mBytesInData < msgLen + 2)
break; //wait for full line end
- char msg[1024];
- memcpy(msg, info->mData, peol - info->mData); msg[peol - info->mData] = 0;
+ ptrA msg(mir_strndup(info->mData, msgLen));
if (*++peol != '\n')
debugLogA("Dodgy line ending to command: ignoring");
else
peol++;
- info->mBytesInData -= peol - info->mData;
+ info->mBytesInData -= msgLen;
memmove(info->mData, peol, info->mBytesInData);
debugLogA("RECV: %s", msg);