VeraCrypt
aboutsummaryrefslogtreecommitdiff
path: root/src/Format/InPlace.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/Format/InPlace.c')
-rw-r--r--src/Format/InPlace.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/Format/InPlace.c b/src/Format/InPlace.c
index b1bfac98..5c8cb3b4 100644
--- a/src/Format/InPlace.c
+++ b/src/Format/InPlace.c
@@ -861,10 +861,18 @@ inplace_enc_read:
if (wipeAlgorithm != TC_WIPE_NONE)
{
byte wipePass;
+ int wipePassCount = GetWipePassCount (wipeAlgorithm);
+
+ if (wipePassCount <= 0)
+ {
+ SetLastError (ERROR_INVALID_PARAMETER);
+ nStatus = ERR_PARAMETER_INCORRECT;
+ goto closing_seq;
+ }
offset.QuadPart = masterCryptoInfo->EncryptedAreaStart.Value - workChunkSize;
- for (wipePass = 1; wipePass <= GetWipePassCount (wipeAlgorithm); ++wipePass)
+ for (wipePass = 1; wipePass <= wipePassCount; ++wipePass)
{
if (!WipeBuffer (wipeAlgorithm, wipeRandChars, wipePass, wipeBuffer, workChunkSize))
{