diff options
author | Mounir IDRASSI <mounir.idrassi@idrix.fr> | 2015-08-24 01:31:30 +0200 |
---|---|---|
committer | Mounir IDRASSI <mounir.idrassi@idrix.fr> | 2015-08-27 02:18:40 +0200 |
commit | ad3b8eca694ed4d7a0ff17f955736725aad0cea6 (patch) | |
tree | 1faaca5e08fdd89b7304b2ceec00366e4fb70564 /src/ExpandVolume/WinMain.cpp | |
parent | 20cb199e55f2f29316a24ff5723c2f8e3b0f4a98 (diff) | |
download | VeraCrypt-ad3b8eca694ed4d7a0ff17f955736725aad0cea6.tar.gz VeraCrypt-ad3b8eca694ed4d7a0ff17f955736725aad0cea6.zip |
Windows: Protect against using a container file as its own keyfile. Normalizing path names to never use '/' but always '\'.
Diffstat (limited to 'src/ExpandVolume/WinMain.cpp')
-rw-r--r-- | src/ExpandVolume/WinMain.cpp | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/ExpandVolume/WinMain.cpp b/src/ExpandVolume/WinMain.cpp index 6bf40477..e02db649 100644 --- a/src/ExpandVolume/WinMain.cpp +++ b/src/ExpandVolume/WinMain.cpp @@ -367,7 +367,7 @@ GetItemLong (HWND hTree, int itemNo) return item.lParam; } -static char PasswordDlgVolume[MAX_PATH + 1]; +static char PasswordDlgVolume[MAX_PATH + 1] = {0}; static BOOL PasswordDialogDisableMountOptions; static char *PasswordDialogTitleStringId; @@ -655,7 +655,7 @@ BOOL CALLBACK ExtcvPasswordDlgProc (HWND hwndDlg, UINT msg, WPARAM wParam, LPARA if (lw == IDOK)
{
if (mountOptions.ProtectHiddenVolume && hidVolProtKeyFilesParam.EnableKeyFiles)
- KeyFilesApply (hwndDlg, &mountOptions.ProtectedHidVolPassword, hidVolProtKeyFilesParam.FirstKeyFile);
+ KeyFilesApply (hwndDlg, &mountOptions.ProtectedHidVolPassword, hidVolProtKeyFilesParam.FirstKeyFile, PasswordDlgVolume);
GetWindowText (GetDlgItem (hwndDlg, IDC_PASSWORD), (LPSTR) szXPwd->Text, MAX_PASSWORD + 1);
szXPwd->Length = strlen ((char *) szXPwd->Text);
@@ -780,7 +780,7 @@ int RestoreVolumeHeader (HWND hwndDlg, char *lpszVolume) return 0; } -int ExtcvAskVolumePassword (HWND hwndDlg, Password *password, int *pkcs5, int *pim, BOOL* truecryptMode, char *titleStringId, BOOL enableMountOptions)
+int ExtcvAskVolumePassword (HWND hwndDlg, const char* fileName, Password *password, int *pkcs5, int *pim, BOOL* truecryptMode, char *titleStringId, BOOL enableMountOptions)
{
int result;
PasswordDlgParam dlgParam;
@@ -793,6 +793,8 @@ int ExtcvAskVolumePassword (HWND hwndDlg, Password *password, int *pkcs5, int *p dlgParam.pim = pim;
dlgParam.truecryptMode = truecryptMode;
+ StringCbCopyA (PasswordDlgVolume, sizeof(PasswordDlgVolume), fileName);
+
result = DialogBoxParamW (hInst,
MAKEINTRESOURCEW (IDD_PASSWORD_DLG), hwndDlg,
(DLGPROC) ExtcvPasswordDlgProc, (LPARAM) &dlgParam);
|