diff options
author | George Hazan <ghazan@miranda.im> | 2017-11-15 12:50:38 +0300 |
---|---|---|
committer | George Hazan <ghazan@miranda.im> | 2017-11-15 12:50:38 +0300 |
commit | f6f193f8d9ef286699be2c2282a9c448f7668842 (patch) | |
tree | eb5ca088d0ce320fc6f78a73c857e5899ab51bf0 /protocols/IcqOscarJ | |
parent | 854f47adb115f3d03d6a64543178e84877acb0b4 (diff) |
fixes #1031 (ICQ password must be of 14 chars most)
Diffstat (limited to 'protocols/IcqOscarJ')
-rw-r--r-- | protocols/IcqOscarJ/src/changeinfo.h | 2 | ||||
-rw-r--r-- | protocols/IcqOscarJ/src/icq_constants.h | 2 | ||||
-rw-r--r-- | protocols/IcqOscarJ/src/icq_firstrun.cpp | 6 | ||||
-rw-r--r-- | protocols/IcqOscarJ/src/icq_opts.cpp | 10 | ||||
-rw-r--r-- | protocols/IcqOscarJ/src/icq_proto.h | 5 | ||||
-rw-r--r-- | protocols/IcqOscarJ/src/loginpassword.cpp | 2 | ||||
-rw-r--r-- | protocols/IcqOscarJ/src/upload.cpp | 4 | ||||
-rw-r--r-- | protocols/IcqOscarJ/src/utilities.cpp | 5 | ||||
-rw-r--r-- | protocols/IcqOscarJ/src/version.h | 2 |
9 files changed, 20 insertions, 18 deletions
diff --git a/protocols/IcqOscarJ/src/changeinfo.h b/protocols/IcqOscarJ/src/changeinfo.h index e1679be2e2..9ce6ba0c48 100644 --- a/protocols/IcqOscarJ/src/changeinfo.h +++ b/protocols/IcqOscarJ/src/changeinfo.h @@ -78,7 +78,7 @@ struct ChangeInfoData : public MZeroedObject HWND hwndList;
int editTopIndex;
int iEditItem;
- char Password[PASSWORDMAXLEN];
+ char Password[PASSWORDMAXLEN+1];
SettingItemData *settingData;
diff --git a/protocols/IcqOscarJ/src/icq_constants.h b/protocols/IcqOscarJ/src/icq_constants.h index 34fbcdc135..d8c1072282 100644 --- a/protocols/IcqOscarJ/src/icq_constants.h +++ b/protocols/IcqOscarJ/src/icq_constants.h @@ -631,7 +631,7 @@ #define CLIENT_MD5_STRING "AOL Instant Messenger (SM)"
#define UNIQUEIDSETTING "UIN"
#define UINMAXLEN 11 // DWORD string max len + 1
-#define PASSWORDMAXLEN 128
+#define PASSWORDMAXLEN 14
#define OSCAR_PROXY_HOST "ars.icq.com"
#define OSCAR_PROXY_VERSION 0x044A
diff --git a/protocols/IcqOscarJ/src/icq_firstrun.cpp b/protocols/IcqOscarJ/src/icq_firstrun.cpp index 297449d303..6fe8fb8fd7 100644 --- a/protocols/IcqOscarJ/src/icq_firstrun.cpp +++ b/protocols/IcqOscarJ/src/icq_firstrun.cpp @@ -34,8 +34,8 @@ static void accountLoadDetails(CIcqProto *ppro, HWND hwndDlg) SetDlgItemTextA(hwndDlg, IDC_UIN, pszUIN);
}
- char pszPwd[PASSWORDMAXLEN];
- if (ppro->GetUserStoredPassword(pszPwd, PASSWORDMAXLEN))
+ char pszPwd[PASSWORDMAXLEN+1];
+ if (ppro->GetUserStoredPassword(pszPwd))
SetDlgItemTextA(hwndDlg, IDC_PW, pszPwd);
}
@@ -52,7 +52,7 @@ INT_PTR CALLBACK icq_FirstRunDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR Window_SetIcon_IcoLib(hwndDlg, ppro->m_hProtoIcon);
- SendDlgItemMessage(hwndDlg, IDC_PW, EM_LIMITTEXT, PASSWORDMAXLEN - 1, 0);
+ SendDlgItemMessage(hwndDlg, IDC_PW, EM_LIMITTEXT, PASSWORDMAXLEN, 0);
accountLoadDetails(ppro, hwndDlg);
return TRUE;
diff --git a/protocols/IcqOscarJ/src/icq_opts.cpp b/protocols/IcqOscarJ/src/icq_opts.cpp index 1629b3f7ce..791145180a 100644 --- a/protocols/IcqOscarJ/src/icq_opts.cpp +++ b/protocols/IcqOscarJ/src/icq_opts.cpp @@ -72,11 +72,11 @@ static INT_PTR CALLBACK DlgProcIcqOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LP else // keep it empty when no UIN entered
SetDlgItemTextA(hwndDlg, IDC_ICQNUM, "");
- SendDlgItemMessage(hwndDlg, IDC_PASSWORD, EM_LIMITTEXT, PASSWORDMAXLEN - 1, 0);
+ SendDlgItemMessage(hwndDlg, IDC_PASSWORD, EM_LIMITTEXT, 14, 0);
// bit of a security hole here, since it's easy to extract a password from an edit box
- char pszPwd[PASSWORDMAXLEN];
- if (ppro->GetUserStoredPassword(pszPwd, sizeof(pszPwd)))
+ char pszPwd[PASSWORDMAXLEN+1];
+ if (ppro->GetUserStoredPassword(pszPwd))
SetDlgItemTextA(hwndDlg, IDC_PASSWORD, pszPwd);
LoadDBCheckState(ppro, hwndDlg, IDC_SSL, "SecureConnection", DEFAULT_SECURE_CONNECTION);
@@ -296,7 +296,7 @@ static INT_PTR CALLBACK DlgProcIcqPrivacyOpts(HWND hwndDlg, UINT msg, WPARAM wPa static HWND hCpCombo;
struct CPTABLE {
- WORD cpId;
+ int cpId;
char *cpName;
};
@@ -321,7 +321,7 @@ struct CPTABLE cpTable[] = { static BOOL CALLBACK FillCpCombo(LPSTR str)
{
- UINT i, cp = atoi(str);
+ int i, cp = atoi(str);
for (i = 0; cpTable[i].cpName != nullptr && cpTable[i].cpId != cp; i++);
if (cpTable[i].cpName)
ComboBoxAddStringUtf(hCpCombo, cpTable[i].cpName, cpTable[i].cpId);
diff --git a/protocols/IcqOscarJ/src/icq_proto.h b/protocols/IcqOscarJ/src/icq_proto.h index e8d58150bc..37d46889f1 100644 --- a/protocols/IcqOscarJ/src/icq_proto.h +++ b/protocols/IcqOscarJ/src/icq_proto.h @@ -161,7 +161,7 @@ struct CIcqProto : public PROTO<CIcqProto> DWORD m_dwLocalUIN;
BYTE m_bConnectionLost;
- char m_szPassword[PASSWORDMAXLEN];
+ char m_szPassword[PASSWORDMAXLEN+1];
BYTE m_bRememberPwd;
int cheekySearchId;
@@ -847,7 +847,8 @@ struct CIcqProto : public PROTO<CIcqProto> //----| utilities.cpp |---------------------------------------------------------------
char* ConvertMsgToUserSpecificAnsi(MCONTACT hContact, const char* szMsg);
- char* GetUserStoredPassword(char *szBuffer, size_t cbSize);
+ template <size_t cbSize>
+ char* GetUserStoredPassword(char(&szBuffer)[cbSize]);
char* GetUserPassword(BOOL bAlways);
WORD GetMyStatusFlags();
diff --git a/protocols/IcqOscarJ/src/loginpassword.cpp b/protocols/IcqOscarJ/src/loginpassword.cpp index a99e1e6849..8d76ee7bba 100644 --- a/protocols/IcqOscarJ/src/loginpassword.cpp +++ b/protocols/IcqOscarJ/src/loginpassword.cpp @@ -44,7 +44,7 @@ INT_PTR CALLBACK LoginPasswdDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA mir_snwprintf(pszUIN, TranslateT("Enter a password for UIN %u:"), dwUin);
SetDlgItemText(hwndDlg, IDC_INSTRUCTION, pszUIN);
- SendDlgItemMessage(hwndDlg, IDC_LOGINPW, EM_LIMITTEXT, PASSWORDMAXLEN - 1, 0);
+ SendDlgItemMessage(hwndDlg, IDC_LOGINPW, EM_LIMITTEXT, PASSWORDMAXLEN, 0);
CheckDlgButton(hwndDlg, IDC_SAVEPASS, ppro->getByte("RememberPass", 0) ? BST_CHECKED : BST_UNCHECKED);
}
diff --git a/protocols/IcqOscarJ/src/upload.cpp b/protocols/IcqOscarJ/src/upload.cpp index f714c9cecc..431d946028 100644 --- a/protocols/IcqOscarJ/src/upload.cpp +++ b/protocols/IcqOscarJ/src/upload.cpp @@ -74,10 +74,10 @@ int ChangeInfoData::UploadSettings(void) mir_strcpy(ppro->m_szPassword, tmp);
hUpload[1] = (HANDLE)ppro->icq_changeUserPasswordServ(tmp);
- char szPwd[PASSWORDMAXLEN] = {0};
// password is stored in DB, update
- if (ppro->GetUserStoredPassword(szPwd, sizeof(szPwd)))
+ char szPwd[PASSWORDMAXLEN + 1];
+ if (ppro->GetUserStoredPassword(szPwd))
ppro->setString("Password", tmp);
}
}
diff --git a/protocols/IcqOscarJ/src/utilities.cpp b/protocols/IcqOscarJ/src/utilities.cpp index af26203a66..9242e1e063 100644 --- a/protocols/IcqOscarJ/src/utilities.cpp +++ b/protocols/IcqOscarJ/src/utilities.cpp @@ -1461,7 +1461,8 @@ char* __fastcall ICQTranslateUtfStatic(const char *src, char *buf, size_t bufsiz return buf;
}
-char* CIcqProto::GetUserStoredPassword(char *szBuffer, size_t cbSize)
+template<size_t cbSize>
+char* CIcqProto::GetUserStoredPassword(char(&szBuffer)[cbSize])
{
if (!getSettingStringStatic(NULL, "Password", szBuffer, cbSize))
if (mir_strlen(szBuffer))
@@ -1476,7 +1477,7 @@ char* CIcqProto::GetUserPassword(BOOL bAlways) if (m_szPassword[0] != '\0' && (m_bRememberPwd || bAlways))
return m_szPassword;
- if (GetUserStoredPassword(m_szPassword, sizeof(m_szPassword))) {
+ if (GetUserStoredPassword(m_szPassword)) {
m_bRememberPwd = true;
return m_szPassword;
}
diff --git a/protocols/IcqOscarJ/src/version.h b/protocols/IcqOscarJ/src/version.h index 35787fc3aa..f275a79fa3 100644 --- a/protocols/IcqOscarJ/src/version.h +++ b/protocols/IcqOscarJ/src/version.h @@ -1,7 +1,7 @@ #define __MAJOR_VERSION 0
#define __MINOR_VERSION 11
#define __RELEASE_NUM 3
-#define __BUILD_NUM 5
+#define __BUILD_NUM 6
#include <stdver.h>
|