From ae3d8dc30d0f8deb28d7dcebb3bc839ceee02bee Mon Sep 17 00:00:00 2001 From: George Hazan Date: Fri, 26 Apr 2013 17:49:35 +0000 Subject: Skype: memory corruption fix git-svn-id: http://svn.miranda-ng.org/main/trunk@4537 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- protocols/Skype/src/skype_events.cpp | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) (limited to 'protocols/Skype') diff --git a/protocols/Skype/src/skype_events.cpp b/protocols/Skype/src/skype_events.cpp index 56fc74a695..d7b120e074 100644 --- a/protocols/Skype/src/skype_events.cpp +++ b/protocols/Skype/src/skype_events.cpp @@ -54,8 +54,8 @@ int CSkypeProto::OnMessagePreCreate(WPARAM, LPARAM lParam) SEBinary guid; if (message->GetPropGuid(guid)) { - evt->dbei->pBlob = (PBYTE)::mir_realloc(evt->dbei->pBlob, guid.size() + 1); - ::strncpy((char *)&evt->dbei->pBlob[evt->dbei->cbBlob], guid.data(), guid.size()); + evt->dbei->pBlob = (PBYTE)::mir_realloc(evt->dbei->pBlob, evt->dbei->cbBlob + guid.size()); + ::memcpy((char *)&evt->dbei->pBlob[evt->dbei->cbBlob], guid.data(), guid.size()); } return 1; @@ -441,26 +441,26 @@ void CSkypeProto::OnMessage(CConversation::Ref conversation, CMessage::Ref messa } break; - case CMessage::STARTED_LIVESESSION: - //conversation->LeaveLiveSession(); - + case CMessage::STARTED_LIVESESSION: + //conversation->LeaveLiveSession(); + uint timestamp; - message->GetPropTimestamp(timestamp); - + message->GetPropTimestamp(timestamp); + SEString identity; message->GetPropAuthor(identity); CContact::Ref author; - g_skype->GetContact(identity, author); - - HANDLE hContact = this->AddContact(author); - - wchar_t *message = new wchar_t[14]; - ::wcscpy(message, L"Incoming call"); - - this->AddDataBaseEvent( - hContact, - SKYPE_DB_EVENT_TYPE_CALL, + g_skype->GetContact(identity, author); + + HANDLE hContact = this->AddContact(author); + + wchar_t *message = new wchar_t[14]; + ::wcscpy(message, L"Incoming call"); + + this->AddDataBaseEvent( + hContact, + SKYPE_DB_EVENT_TYPE_CALL, timestamp, DBEF_UTF, (DWORD)::wcslen(message) + 1, -- cgit v1.2.3