Skip to content

Commit

Permalink
Proper import account keys instead of memcpy because AccountKeys is n…
Browse files Browse the repository at this point in the history
…on-trivially copyable type
  • Loading branch information
aivve committed Jul 29, 2022
1 parent ca38ae8 commit 09b015f
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions src/gui/MainWindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,10 @@

#include "MainWindow.h"

#include <Common/Base58.h>
#include <Common/StringTools.h>
#include <Common/Util.h>
#include "Common/Base58.h"
#include "Common/StringTools.h"
#include "Common/Util.h"
#include "CryptoNoteCore/CryptoNoteTools.h"
#include "AboutDialog.h"
#include "AnimatedLabel.h"
#include "AddressBookModel.h"
Expand Down Expand Up @@ -484,7 +485,10 @@ void MainWindow::importKey() {
CryptoNote::AccountKeys keys;
if (Tools::Base58::decode_addr(keyString.toStdString(), addressPrefix, data) && addressPrefix == CurrencyAdapter::instance().getAddressPrefix() &&
data.size() == sizeof(keys)) {
std::memcpy(&keys, data.data(), sizeof(keys));
//std::memcpy(&keys, data.data(), sizeof(keys));
if (!fromBinaryArray(keys, Common::asBinaryArray(data))) {
QMessageBox::warning(this, tr("Wallet keys are not valid"), tr("Failed to parse account keys"), QMessageBox::Ok);
}
if (WalletAdapter::instance().isOpen()) {
WalletAdapter::instance().close();
}
Expand Down

0 comments on commit 09b015f

Please sign in to comment.