From bb1a3cdefb28e4468018d50fbb9d16778abe4d6e Mon Sep 17 00:00:00 2001 From: George Hazan Date: Sun, 16 Feb 2014 21:07:53 +0000 Subject: potential flaw in UserInfoEx (64 bits) git-svn-id: http://svn.miranda-ng.org/main/trunk@8148 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/UserInfoEx/src/commonheaders.h | 2 +- plugins/UserInfoEx/src/dlg_propsheet.cpp | 31 +++++++++---------------------- 2 files changed, 10 insertions(+), 23 deletions(-) (limited to 'plugins') diff --git a/plugins/UserInfoEx/src/commonheaders.h b/plugins/UserInfoEx/src/commonheaders.h index 8d02bf2cac..f789243f8c 100644 --- a/plugins/UserInfoEx/src/commonheaders.h +++ b/plugins/UserInfoEx/src/commonheaders.h @@ -104,7 +104,7 @@ using namespace std; #define MIRSUCCEEDED(f) ((f)==MIR_OK) #define MIRFAILED(f) ((f)!=MIR_OK) -#define MIREXISTS(f) ((int)(f)!=CALLSERVICE_NOTFOUND) +#define MIREXISTS(f) ((INT_PTR)(f)!=CALLSERVICE_NOTFOUND) #define PtrIsValid(p) (((p)!=0)&&(((HANDLE)(p))!=INVALID_HANDLE_VALUE)) #define FREE(p) {if (PtrIsValid(p)){free((void*)p);(p)=NULL;}} diff --git a/plugins/UserInfoEx/src/dlg_propsheet.cpp b/plugins/UserInfoEx/src/dlg_propsheet.cpp index 44009f8722..f5da4c7488 100644 --- a/plugins/UserInfoEx/src/dlg_propsheet.cpp +++ b/plugins/UserInfoEx/src/dlg_propsheet.cpp @@ -203,11 +203,8 @@ public: **/ int UploadNext() { - CHAR str[MAXMODULELABELLENGTH]; while (_pPd && *_pPd && _numProto-- > 0) { - mir_strncpy(str, (*_pPd)->szModuleName, MAXMODULELABELLENGTH); - mir_strncat(str, PS_CHANGEINFOEX, MAXMODULELABELLENGTH); - if (ServiceExists(str) && !Upload()) { + if (ProtoServiceExists((*_pPd)->szModuleName, PS_CHANGEINFOEX) && !Upload()) { _pPd++; return UPLOAD_CONTINUE; } @@ -642,23 +639,14 @@ void DlgContactInfoLoadModule() ghWindowList = WindowList_Create(); // check whether changing my details via UserInfoEx is basically possible - { - PROTOACCOUNT **pAcc; - int i, nAccCount; - - myGlobals.CanChangeDetails = FALSE; - if (MIRSUCCEEDED(ProtoEnumAccounts(&nAccCount, &pAcc))) - { - for (i = 0; (i < nAccCount) && !myGlobals.CanChangeDetails; i++) - { - if (IsProtoAccountEnabled(pAcc[i])) - { - // update my contact information on icq server - myGlobals.CanChangeDetails = MIREXISTS(CallProtoService(pAcc[i]->szModuleName, PS_CHANGEINFOEX, NULL, NULL)); - } - } - } - } + myGlobals.CanChangeDetails = FALSE; + + PROTOACCOUNT **pAcc; + int nAccCount; + if (MIRSUCCEEDED(ProtoEnumAccounts(&nAccCount, &pAcc))) + for (int i = 0; (i < nAccCount) && !myGlobals.CanChangeDetails; i++) + if (IsProtoAccountEnabled(pAcc[i])) // update my contact information on icq server + myGlobals.CanChangeDetails = MIREXISTS(CallProtoService(pAcc[i]->szModuleName, PS_CHANGEINFOEX, NULL, NULL)); } static void ResetUpdateInfo(LPPS pPs) @@ -1682,4 +1670,3 @@ static INT_PTR CALLBACK DlgProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lPar } return FALSE; } - -- cgit v1.2.3