Skip to content

Commit

Permalink
Windows: Fix regression causing crash when a wrong password is used w…
Browse files Browse the repository at this point in the history
…hen changing password of volumes
  • Loading branch information
idrassi committed Aug 24, 2024
1 parent 25c88fe commit 380ca35
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/Common/BootEncryption.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5443,7 +5443,7 @@ namespace VeraCrypt
finally_do_arg (PCRYPTO_INFO, cryptoInfo, { if (finally_arg) crypto_close (finally_arg); });

// if the XTS master key is vulnerable, return error and do not allow the user to change the password since the master key will not be changed
if (cryptoInfo->bVulnerableMasterKey)
if ((status == 0) && cryptoInfo->bVulnerableMasterKey)
status = ERR_SYSENC_XTS_MASTERKEY_VULNERABLE;

if (status != 0)
Expand Down
2 changes: 1 addition & 1 deletion src/Common/Password.c
Original file line number Diff line number Diff line change
Expand Up @@ -372,7 +372,7 @@ int ChangePwd (const wchar_t *lpszVolume, Password *oldPassword, int old_pkcs5,
nStatus = 0; // We can ignore this error here

// if the XTS master key is vulnerable, return error and do not allow the user to change the password since the master key will not be changed
if (cryptoInfo->bVulnerableMasterKey)
if ((nStatus == 0) && cryptoInfo->bVulnerableMasterKey)
nStatus = ERR_XTS_MASTERKEY_VULNERABLE;

if (nStatus == ERR_PASSWORD_WRONG)
Expand Down
2 changes: 1 addition & 1 deletion src/ExpandVolume/ExpandVolume.c
Original file line number Diff line number Diff line change
Expand Up @@ -692,7 +692,7 @@ static int ExpandVolume (HWND hwndDlg, wchar_t *lpszVolume, Password *pVolumePas
nStatus = 0; // We can ignore this error here

// if the volume master key is vulnerable, print a warning to inform the user
if (cryptoInfo->bVulnerableMasterKey)
if ((nStatus == 0) && cryptoInfo->bVulnerableMasterKey)
{
DebugAddProgressDlgStatus(hwndDlg, GetString ("ERR_XTS_MASTERKEY_VULNERABLE_SHORT"));
}
Expand Down

0 comments on commit 380ca35

Please sign in to comment.