From 62713cf3eece92588464ce06810146f5c5cece8e Mon Sep 17 00:00:00 2001 From: MikalaiR Date: Fri, 2 Oct 2015 15:57:46 +0000 Subject: Steam: fix memory corruptions git-svn-id: http://svn.miranda-ng.org/main/trunk@15487 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- protocols/Steam/src/request_queue.cpp | 1 + protocols/Steam/src/steam_dialogs.cpp | 12 ++++++++---- protocols/Steam/src/steam_dialogs.h | 4 ++-- 3 files changed, 11 insertions(+), 6 deletions(-) (limited to 'protocols') diff --git a/protocols/Steam/src/request_queue.cpp b/protocols/Steam/src/request_queue.cpp index 12f9beb61c..ab5a7e0d75 100644 --- a/protocols/Steam/src/request_queue.cpp +++ b/protocols/Steam/src/request_queue.cpp @@ -78,6 +78,7 @@ void RequestQueue::Execute(RequestQueueItem *item) if (item->finallyCallback != NULL) item->finallyCallback(item->arg); delete item; + delete response; } unsigned int RequestQueue::AsyncSendThread(void *owner, void *arg) diff --git a/protocols/Steam/src/steam_dialogs.cpp b/protocols/Steam/src/steam_dialogs.cpp index 6ea6aecd28..a773a3bd3b 100644 --- a/protocols/Steam/src/steam_dialogs.cpp +++ b/protocols/Steam/src/steam_dialogs.cpp @@ -38,9 +38,12 @@ void CSteamPasswordEditor::OnClose() ///////////////////////////////////////////////////////////////////////////////// CSteamGuardDialog::CSteamGuardDialog(CSteamProto *proto, const char *domain) - : CSteamDlgBase(proto, IDD_GUARD, false), m_ok(this, IDOK), - m_text(this, IDC_TEXT), m_link(this, IDC_GETDOMAIN, domain) + : CSteamDlgBase(proto, IDD_GUARD, false), + m_ok(this, IDOK), + m_text(this, IDC_TEXT), + m_link(this, IDC_GETDOMAIN, domain) { + memset(m_guardCode, 0, sizeof(m_guardCode)); mir_strcpy(m_domain, domain); m_ok.OnClick = Callback(this, &CSteamGuardDialog::OnOk); } @@ -59,7 +62,7 @@ void CSteamGuardDialog::OnInitDialog() void CSteamGuardDialog::OnOk(CCtrlButton*) { - mir_strncpy(m_guardCode, ptrA(m_text.GetTextA()), _countof(m_guardCode) + 1); + mir_strncpy(m_guardCode, ptrA(m_text.GetTextA()), _countof(m_guardCode)); EndDialog(m_hwnd, 1); } @@ -80,6 +83,7 @@ CSteamCaptchaDialog::CSteamCaptchaDialog(CSteamProto *proto, BYTE *captchaImage, m_ok(this, IDOK), m_text(this, IDC_TEXT), m_captchaImage(NULL) { + memset(m_captchaText, 0, sizeof(m_captchaText)); m_captchaImageSize = captchaImageSize; m_captchaImage = (BYTE*)mir_alloc(captchaImageSize); memcpy(m_captchaImage, captchaImage, captchaImageSize); @@ -106,7 +110,7 @@ void CSteamCaptchaDialog::OnInitDialog() void CSteamCaptchaDialog::OnOk(CCtrlButton*) { - mir_strncpy(m_captchaText, ptrA(m_text.GetTextA()), _countof(m_captchaText) + 1); + mir_strncpy(m_captchaText, ptrA(m_text.GetTextA()), _countof(m_captchaText)); EndDialog(m_hwnd, 1); } diff --git a/protocols/Steam/src/steam_dialogs.h b/protocols/Steam/src/steam_dialogs.h index 21cc2e2033..2915e5fecc 100644 --- a/protocols/Steam/src/steam_dialogs.h +++ b/protocols/Steam/src/steam_dialogs.h @@ -28,7 +28,7 @@ class CSteamGuardDialog : public CSteamDlgBase { private: char m_domain[32]; - char m_guardCode[5]; + char m_guardCode[6]; CCtrlEdit m_text; CCtrlButton m_ok; @@ -50,7 +50,7 @@ public: class CSteamCaptchaDialog : public CSteamDlgBase { private: - char m_captchaText[6]; + char m_captchaText[7]; BYTE *m_captchaImage; int m_captchaImageSize; -- cgit v1.2.3