diff options
-rwxr-xr-x[-rw-r--r--] | src/Main/Forms/ChangePasswordDialog.cpp | 20 | ||||
-rwxr-xr-x[-rw-r--r--] | src/Main/Forms/MountOptionsDialog.cpp | 23 | ||||
-rwxr-xr-x[-rw-r--r--] | src/Main/Forms/VolumeCreationWizard.cpp | 6 | ||||
-rwxr-xr-x[-rw-r--r--] | src/Main/Forms/VolumePasswordPanel.cpp | 3 | ||||
-rwxr-xr-x[-rw-r--r--] | src/Main/Forms/VolumePimWizardPage.cpp | 3 |
5 files changed, 50 insertions, 5 deletions
diff --git a/src/Main/Forms/ChangePasswordDialog.cpp b/src/Main/Forms/ChangePasswordDialog.cpp index 9b69be0b..b3e0bd04 100644..100755 --- a/src/Main/Forms/ChangePasswordDialog.cpp +++ b/src/Main/Forms/ChangePasswordDialog.cpp @@ -92,6 +92,12 @@ namespace VeraCrypt Gui->ShowWarning (LangString ["ALGO_NOT_SUPPORTED_FOR_TRUECRYPT_MODE"]); return; } + int currentPim = CurrentPasswordPanel->GetVolumePim(); + if (-1 == currentPim) + { + CurrentPasswordPanel->SetFocusToPimTextCtrl(); + return; + } shared_ptr <VolumePassword> newPassword; int newPim = 0; @@ -108,6 +114,11 @@ namespace VeraCrypt return; } newPim = NewPasswordPanel->GetVolumePim(); + if (-1 == newPim) + { + NewPasswordPanel->SetFocusToPimTextCtrl(); + return; + } if (newPassword->Size() > 0) { @@ -224,6 +235,9 @@ namespace VeraCrypt if (passwordEmpty && keyfilesEmpty) ok = false; + + if (CurrentPasswordPanel->GetVolumePim () == -1) + ok = false; if (DialogMode == Mode::RemoveAllKeyfiles && (passwordEmpty || keyfilesEmpty)) ok = false; @@ -237,7 +251,11 @@ namespace VeraCrypt ok = false; if (DialogMode == Mode::ChangePasswordAndKeyfiles - && ((NewPasswordPanel->GetPassword()->IsEmpty() && newKeyfilesEmpty) || !NewPasswordPanel->PasswordsMatch())) + && ( (NewPasswordPanel->GetPassword()->IsEmpty() && newKeyfilesEmpty) + || !NewPasswordPanel->PasswordsMatch() + || (NewPasswordPanel->GetVolumePim() == -1) + ) + ) ok = false; } } diff --git a/src/Main/Forms/MountOptionsDialog.cpp b/src/Main/Forms/MountOptionsDialog.cpp index 14198e68..207d2479 100644..100755 --- a/src/Main/Forms/MountOptionsDialog.cpp +++ b/src/Main/Forms/MountOptionsDialog.cpp @@ -87,6 +87,25 @@ namespace VeraCrypt void MountOptionsDialog::OnOKButtonClick (wxCommandEvent& event) { bool bUnsupportedKdf = false; + + /* verify that PIM values are valid before continuing*/ + int Pim = PasswordPanel->GetVolumePim(); + int ProtectionPim = (!ReadOnlyCheckBox->IsChecked() && ProtectionCheckBox->IsChecked())? + ProtectionPasswordPanel->GetVolumePim() : 0; + + /* invalid PIM: set focus to PIM field and stop processing */ + if (-1 == Pim) + { + PasswordPanel->SetFocusToPimTextCtrl(); + return; + } + + if (-1 == ProtectionPim) + { + ProtectionPasswordPanel->SetFocusToPimTextCtrl(); + return; + } + TransferDataFromWindow(); try @@ -98,7 +117,7 @@ namespace VeraCrypt Gui->ShowWarning (e); return; } - Options.Pim = PasswordPanel->GetVolumePim(); + Options.Pim = Pim; Options.Kdf = PasswordPanel->GetPkcs5Kdf(bUnsupportedKdf); if (bUnsupportedKdf) { @@ -124,7 +143,7 @@ namespace VeraCrypt return; } Options.Protection = VolumeProtection::HiddenVolumeReadOnly; - Options.ProtectionPim = ProtectionPasswordPanel->GetVolumePim(); + Options.ProtectionPim = ProtectionPim; Options.ProtectionKdf = ProtectionPasswordPanel->GetPkcs5Kdf(Options.TrueCryptMode, bUnsupportedKdf); if (bUnsupportedKdf) { diff --git a/src/Main/Forms/VolumeCreationWizard.cpp b/src/Main/Forms/VolumeCreationWizard.cpp index d67f0fe7..a250625b 100644..100755 --- a/src/Main/Forms/VolumeCreationWizard.cpp +++ b/src/Main/Forms/VolumeCreationWizard.cpp @@ -792,6 +792,12 @@ namespace VeraCrypt if (forward && Password && !Password->IsEmpty()) { + if (-1 == Pim) + { + // PIM invalid: don't go anywhere + return GetCurrentStep(); + } + if (Password->Size() < VolumePassword::WarningSizeThreshold) { if (Pim > 0 && Pim < 485) diff --git a/src/Main/Forms/VolumePasswordPanel.cpp b/src/Main/Forms/VolumePasswordPanel.cpp index 9c0f06ec..16fafa3a 100644..100755 --- a/src/Main/Forms/VolumePasswordPanel.cpp +++ b/src/Main/Forms/VolumePasswordPanel.cpp @@ -278,7 +278,8 @@ namespace VeraCrypt long pim = 0; if (pimStr.IsEmpty()) return 0; - if (pimStr.ToLong (&pim)) + if (((size_t) wxNOT_FOUND == pimStr.find_first_not_of (wxT("0123456789"))) + && pimStr.ToLong (&pim)) return (int) pim; else return -1; diff --git a/src/Main/Forms/VolumePimWizardPage.cpp b/src/Main/Forms/VolumePimWizardPage.cpp index c5f5e889..0e3d4299 100644..100755 --- a/src/Main/Forms/VolumePimWizardPage.cpp +++ b/src/Main/Forms/VolumePimWizardPage.cpp @@ -38,7 +38,8 @@ namespace VeraCrypt long pim = 0; if (pimStr.IsEmpty()) return 0; - if (pimStr.ToLong (&pim)) + if (((size_t) wxNOT_FOUND == pimStr.find_first_not_of (wxT("0123456789"))) + && pimStr.ToLong (&pim)) return (int) pim; else return -1; |