aboutsummaryrefslogtreecommitdiff
path: root/src/qt/askpassphrasedialog.cpp
diff options
context:
space:
mode:
authorLuke Dashjr <luke-jr+git@utopios.org>2016-08-09 05:45:50 +0000
committerLuke Dashjr <luke-jr+git@utopios.org>2016-08-09 05:45:50 +0000
commitdf634908ba758232413c50e8f1f7a80d546d777b (patch)
tree92cccae378b192f5f70986d2167209cbfd24ae08 /src/qt/askpassphrasedialog.cpp
parente98e3dde6a976a2c8f266ee963d6931fd4b37262 (diff)
parente4382fbef56a0e04b0ed834e8b3a3a16f81db149 (diff)
downloadbitcoin-df634908ba758232413c50e8f1f7a80d546d777b.tar.xz
Merge tag 'branch-0.13' into bugfix_gitdir
Diffstat (limited to 'src/qt/askpassphrasedialog.cpp')
-rw-r--r--src/qt/askpassphrasedialog.cpp37
1 files changed, 27 insertions, 10 deletions
diff --git a/src/qt/askpassphrasedialog.cpp b/src/qt/askpassphrasedialog.cpp
index fa9ac6b135..e8aa79679c 100644
--- a/src/qt/askpassphrasedialog.cpp
+++ b/src/qt/askpassphrasedialog.cpp
@@ -1,14 +1,18 @@
-// Copyright (c) 2011-2013 The Bitcoin developers
-// Distributed under the MIT/X11 software license, see the accompanying
+// Copyright (c) 2011-2015 The Bitcoin Core developers
+// Distributed under the MIT software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
+#if defined(HAVE_CONFIG_H)
+#include "config/bitcoin-config.h"
+#endif
+
#include "askpassphrasedialog.h"
#include "ui_askpassphrasedialog.h"
#include "guiconstants.h"
#include "walletmodel.h"
-#include "allocators.h"
+#include "support/allocators/secure.h"
#include <QKeyEvent>
#include <QMessageBox>
@@ -62,7 +66,7 @@ AskPassphraseDialog::AskPassphraseDialog(Mode mode, QWidget *parent) :
break;
case ChangePass: // Ask old passphrase + new passphrase x2
setWindowTitle(tr("Change passphrase"));
- ui->warningLabel->setText(tr("Enter the old and new passphrase to the wallet."));
+ ui->warningLabel->setText(tr("Enter the old passphrase and new passphrase to the wallet."));
break;
}
textChanged();
@@ -73,10 +77,7 @@ AskPassphraseDialog::AskPassphraseDialog(Mode mode, QWidget *parent) :
AskPassphraseDialog::~AskPassphraseDialog()
{
- // Attempt to overwrite text so that they do not linger around in memory
- ui->passEdit1->setText(QString(" ").repeated(ui->passEdit1->text().size()));
- ui->passEdit2->setText(QString(" ").repeated(ui->passEdit2->text().size()));
- ui->passEdit3->setText(QString(" ").repeated(ui->passEdit3->text().size()));
+ secureClearPassFields();
delete ui;
}
@@ -99,6 +100,8 @@ void AskPassphraseDialog::accept()
newpass1.assign(ui->passEdit2->text().toStdString().c_str());
newpass2.assign(ui->passEdit3->text().toStdString().c_str());
+ secureClearPassFields();
+
switch(mode)
{
case Encrypt: {
@@ -119,9 +122,9 @@ void AskPassphraseDialog::accept()
{
QMessageBox::warning(this, tr("Wallet encrypted"),
"<qt>" +
- tr("Bitcoin will close now to finish the encryption process. "
+ tr("%1 will close now to finish the encryption process. "
"Remember that encrypting your wallet cannot fully protect "
- "your bitcoins from being stolen by malware infecting your computer.") +
+ "your bitcoins from being stolen by malware infecting your computer.").arg(tr(PACKAGE_NAME)) +
"<br><br><b>" +
tr("IMPORTANT: Any previous backups you have made of your wallet file "
"should be replaced with the newly generated, encrypted wallet file. "
@@ -256,3 +259,17 @@ bool AskPassphraseDialog::eventFilter(QObject *object, QEvent *event)
}
return QDialog::eventFilter(object, event);
}
+
+static void SecureClearQLineEdit(QLineEdit* edit)
+{
+ // Attempt to overwrite text so that they do not linger around in memory
+ edit->setText(QString(" ").repeated(edit->text().size()));
+ edit->clear();
+}
+
+void AskPassphraseDialog::secureClearPassFields()
+{
+ SecureClearQLineEdit(ui->passEdit1);
+ SecureClearQLineEdit(ui->passEdit2);
+ SecureClearQLineEdit(ui->passEdit3);
+}