VeraCrypt
aboutsummaryrefslogtreecommitdiff
path: root/src/Mount
diff options
context:
space:
mode:
Diffstat (limited to 'src/Mount')
-rw-r--r--src/Mount/Favorites.cpp16
-rw-r--r--src/Mount/Mount.c9
2 files changed, 23 insertions, 2 deletions
diff --git a/src/Mount/Favorites.cpp b/src/Mount/Favorites.cpp
index 45883bc9..af5f9b0d 100644
--- a/src/Mount/Favorites.cpp
+++ b/src/Mount/Favorites.cpp
@@ -383,6 +383,20 @@ namespace VeraCrypt
case IDC_SHOW_PIM:
HandleShowPasswordFieldAction (hwndDlg, IDC_SHOW_PIM, IDC_PIM, 0);
return 1;
+
+ case IDC_PIM:
+ if (hw == EN_CHANGE)
+ {
+ int pim = GetPim (hwndDlg, IDC_PIM);
+ if (pim > (SystemFavoritesMode? MAX_BOOT_PIM_VALUE: MAX_PIM_VALUE))
+ {
+ SetDlgItemText (hwndDlg, IDC_PIM, L"");
+ SetFocus (GetDlgItem(hwndDlg, IDC_PIM));
+ Warning (SystemFavoritesMode? "PIM_SYSENC_TOO_BIG": "PIM_TOO_BIG", hwndDlg);
+ return 1;
+ }
+ }
+ break;
}
return 0;
@@ -601,7 +615,7 @@ namespace VeraCrypt
XmlGetAttributeText (xml, "pin", label, sizeof (label));
}
favorite.Pim = strtol (label, NULL, 10);
- if (favorite.Pim < 0)
+ if (favorite.Pim < 0 || favorite.Pim > (systemFavorite? MAX_BOOT_PIM_VALUE : MAX_PIM_VALUE))
favorite.Pim = 0;
char boolVal[2];
diff --git a/src/Mount/Mount.c b/src/Mount/Mount.c
index 1851af06..7dabc5ff 100644
--- a/src/Mount/Mount.c
+++ b/src/Mount/Mount.c
@@ -2506,6 +2506,13 @@ BOOL CALLBACK PasswordChangeDlgProc (HWND hwndDlg, UINT msg, WPARAM wParam, LPAR
return 1;
}
+ if (!bSysEncPwdChangeDlgMode && (pim > MAX_PIM_VALUE))
+ {
+ SetFocus (GetDlgItem(hwndDlg, IDC_PIM));
+ Error ("PIM_TOO_BIG", hwndDlg);
+ return 1;
+ }
+
if (pwdChangeDlgMode == PCDM_CHANGE_PKCS5_PRF)
{
newKeyFilesParam.EnableKeyFiles = KeyFilesEnable;
@@ -8712,7 +8719,7 @@ void ExtractCommandLine (HWND hwndDlg, wchar_t *lpszCommandLine)
{
wchar_t* endPtr = NULL;
CmdVolumePim = (int) wcstol(szTmp, &endPtr, 0);
- if (CmdVolumePim < 0 || endPtr == szTmp || *endPtr != L'\0')
+ if (CmdVolumePim < 0 || CmdVolumePim > MAX_PIM_VALUE || endPtr == szTmp || *endPtr != L'\0')
{
CmdVolumePim = 0;
AbortProcess ("COMMAND_LINE_ERROR");