VeraCrypt
aboutsummaryrefslogtreecommitdiff
path: root/src/Common
diff options
context:
space:
mode:
authorMounir IDRASSI <mounir.idrassi@idrix.fr>2019-02-04 10:37:37 (GMT)
committerMounir IDRASSI <mounir.idrassi@idrix.fr>2019-02-04 10:39:47 (GMT)
commit6bb1f24ed571bccd4d1d247dafdc1dda6eaa3d8d (patch)
treecf56d5e0f83ef2fa69580215e60b4106ac888897 /src/Common
parent5d3278bcf20d7b8039747a430f86b7dd5ef49a04 (diff)
downloadVeraCrypt-6bb1f24ed571bccd4d1d247dafdc1dda6eaa3d8d.zip
VeraCrypt-6bb1f24ed571bccd4d1d247dafdc1dda6eaa3d8d.tar.gz
Automatically truncate passwords for TrueCrypt volumes and System Encryption to the first 64 characters. This fix issues encountered by users of TrueCrypt volumes who were using passwords longer than 64 characters that were truncated in previous version.
Diffstat (limited to 'src/Common')
-rw-r--r--src/Common/Dlgcode.c4
-rw-r--r--src/Common/Dlgcode.h2
2 files changed, 4 insertions, 2 deletions
diff --git a/src/Common/Dlgcode.c b/src/Common/Dlgcode.c
index 44cf623..c8efe2a 100644
--- a/src/Common/Dlgcode.c
+++ b/src/Common/Dlgcode.c
@@ -13047,13 +13047,15 @@ void SetPim (HWND hwndDlg, UINT ctrlId, int pim)
SetDlgItemText (hwndDlg, ctrlId, L"");
}
-BOOL GetPassword (HWND hwndDlg, UINT ctrlID, char* passValue, int bufSize, BOOL bShowError)
+BOOL GetPassword (HWND hwndDlg, UINT ctrlID, char* passValue, int bufSize, BOOL bLegacyPassword, BOOL bShowError)
{
wchar_t tmp [MAX_PASSWORD + 1];
int utf8Len;
BOOL bRet = FALSE;
GetWindowText (GetDlgItem (hwndDlg, ctrlID), tmp, ARRAYSIZE (tmp));
+ if (bLegacyPassword && (lstrlen (tmp) > MAX_LEGACY_PASSWORD))
+ wmemset (&tmp[MAX_LEGACY_PASSWORD], 0, MAX_PASSWORD + 1 - MAX_LEGACY_PASSWORD);
utf8Len = WideCharToMultiByte (CP_UTF8, 0, tmp, -1, passValue, bufSize, NULL, NULL);
burn (tmp, sizeof (tmp));
if (utf8Len > 0)
diff --git a/src/Common/Dlgcode.h b/src/Common/Dlgcode.h
index 00a4923..e97e50c 100644
--- a/src/Common/Dlgcode.h
+++ b/src/Common/Dlgcode.h
@@ -515,7 +515,7 @@ BOOL LaunchWindowsIsoBurner (HWND hwnd, const wchar_t *isoPath);
BOOL IsApplicationInstalled (const wchar_t *appName);
int GetPim (HWND hwndDlg, UINT ctrlId, int defaultPim);
void SetPim (HWND hwndDlg, UINT ctrlId, int pim);
-BOOL GetPassword (HWND hwndDlg, UINT ctrlID, char* passValue, int bufSize, BOOL bShowError);
+BOOL GetPassword (HWND hwndDlg, UINT ctrlID, char* passValue, int bufSize, BOOL bLegacyPassword, BOOL bShowError);
void SetPassword (HWND hwndDlg, UINT ctrlID, char* passValue);
void HandleShowPasswordFieldAction (HWND hwndDlg, UINT checkBoxId, UINT edit1Id, UINT edit2Id);
HKEY OpenDeviceClassRegKey (const GUID *deviceClassGuid);