1
0
mirror of https://github.com/veracrypt/VeraCrypt.git synced 2025-11-11 19:08:26 -06:00

Linux/macOS: only wipe password/PIM text controls if they are not empty

This fixes a crash on macOS with latest wxWidgets 3.2.2.1 where
GetLineLength returns -1
This commit is contained in:
Mounir IDRASSI
2023-06-14 00:31:46 +02:00
parent 440df02355
commit 36a055f669
2 changed files with 10 additions and 2 deletions

View File

@@ -459,7 +459,11 @@ namespace VeraCrypt
void VolumePasswordPanel::WipeTextCtrl (wxTextCtrl *textCtrl) void VolumePasswordPanel::WipeTextCtrl (wxTextCtrl *textCtrl)
{ {
textCtrl->SetValue (wxString (L'X', textCtrl->GetLineLength(0))); int txtLen = textCtrl->GetLineLength(0);
if (txtLen > 0)
{
textCtrl->SetValue (wxString (L'X', txtLen));
}
GetPassword (textCtrl); GetPassword (textCtrl);
} }

View File

@@ -110,7 +110,11 @@ namespace VeraCrypt
PimSizer->Replace (VolumePimTextCtrl, newTextCtrl); PimSizer->Replace (VolumePimTextCtrl, newTextCtrl);
VolumePimTextCtrl->Show (false); VolumePimTextCtrl->Show (false);
VolumePimTextCtrl->SetValue (wxString (L'X', VolumePimTextCtrl->GetLineLength(0))); int txtLen = VolumePimTextCtrl->GetLineLength(0);
if (txtLen > 0)
{
VolumePimTextCtrl->SetValue (wxString (L'X', txtLen));
}
GetVolumePim (); GetVolumePim ();
Fit(); Fit();