diff options
author | George Hazan <george.hazan@gmail.com> | 2015-05-15 13:31:23 +0000 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2015-05-15 13:31:23 +0000 |
commit | 03db06c52cad84ecb2bf0b3fff8a518ff895dc19 (patch) | |
tree | 33051c9755dca9745607c6fafd233fc5f5f307b6 /protocols/MSN/src/msn_threads.cpp | |
parent | 714b5dfb8f159c8d54ef42c905c3c85f4b4e7962 (diff) |
- crash fix in chats;
- static buffer returned, now with buffer overrun control;
- warnings fixed
git-svn-id: http://svn.miranda-ng.org/main/trunk@13604 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols/MSN/src/msn_threads.cpp')
-rw-r--r-- | protocols/MSN/src/msn_threads.cpp | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/protocols/MSN/src/msn_threads.cpp b/protocols/MSN/src/msn_threads.cpp index f9be399735..6a531525a1 100644 --- a/protocols/MSN/src/msn_threads.cpp +++ b/protocols/MSN/src/msn_threads.cpp @@ -206,7 +206,8 @@ void __cdecl CMsnProto::MSNServerThread(void* arg) if (info->mBytesInData < msgLen + 2)
break; //wait for full line end
- ptrA msg(mir_strndup(info->mData, msgLen));
+ char msg[1024];
+ strncpy_s(msg, info->mData, _TRUNCATE);
if (*++peol != '\n')
debugLogA("Dodgy line ending to command: ignoring");
@@ -357,8 +358,10 @@ ThreadData* CMsnProto::MSN_GetThreadByContact(const char* wlid, TInfoType type) GCThreadData* CMsnProto::MSN_GetThreadByChatId(const TCHAR* chatId)
{
- mir_cslock lck(m_csThreads);
+ if (mir_tstrlen(chatId) == 0)
+ return NULL;
+ mir_cslock lck(m_csThreads);
for (int i = 0; i < m_arGCThreads.getCount(); i++) {
GCThreadData *T = m_arGCThreads[i];
if (_tcsicmp(T->mChatID, chatId) == 0)
|