VeraCrypt
aboutsummaryrefslogtreecommitdiff
path: root/src/Mount/Favorites.cpp
diff options
context:
space:
mode:
authorMounir IDRASSI <mounir.idrassi@idrix.fr>2016-05-02 12:45:22 (GMT)
committerMounir IDRASSI <mounir.idrassi@idrix.fr>2016-05-04 11:14:05 (GMT)
commitb261177b8f5bc3f8495406d13dc03c0328b930f9 (patch)
tree535b8a6345c63529b3bc72f42d02c27c6aed64e3 /src/Mount/Favorites.cpp
parent0b914c8f5d690dfc1bdfbca1e1083372c5ed84d8 (diff)
downloadVeraCrypt-b261177b8f5bc3f8495406d13dc03c0328b930f9.zip
VeraCrypt-b261177b8f5bc3f8495406d13dc03c0328b930f9.tar.gz
Windows/Linux/MacOSX: Set maximum PIM value to 2147468 in order to avoid having negative values for iterations count using the formula 15000 + (PIM x 1000). Add specific error message to XML language files.
Diffstat (limited to 'src/Mount/Favorites.cpp')
-rw-r--r--src/Mount/Favorites.cpp16
1 files changed, 15 insertions, 1 deletions
diff --git a/src/Mount/Favorites.cpp b/src/Mount/Favorites.cpp
index 45883bc..af5f9b0 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];