aboutsummaryrefslogtreecommitdiff
path: root/src/simplewallet/simplewallet.cpp
diff options
context:
space:
mode:
authorRiccardo Spagni <ric@spagni.net>2017-02-21 00:51:46 +0200
committerRiccardo Spagni <ric@spagni.net>2017-02-21 00:51:46 +0200
commitba633d33a83abd71498e420ad6d81a55653d2a91 (patch)
tree1a929b9b4f68b2087f0ebf15e45d14160b536172 /src/simplewallet/simplewallet.cpp
parent675434ffab89fd22b03398ae2075fee42ed643e0 (diff)
parent83ec209f42f02deab973254231efeb794edf2c16 (diff)
downloadmonzero-core-ba633d33a83abd71498e420ad6d81a55653d2a91.tar.gz
monzero-core-ba633d33a83abd71498e420ad6d81a55653d2a91.tar.xz
monzero-core-ba633d33a83abd71498e420ad6d81a55653d2a91.zip
Merge pull request #1732
83ec209f simplewallet: validate hex input size (moneromooo-monero)
Diffstat (limited to 'src/simplewallet/simplewallet.cpp')
-rw-r--r--src/simplewallet/simplewallet.cpp18
1 files changed, 9 insertions, 9 deletions
diff --git a/src/simplewallet/simplewallet.cpp b/src/simplewallet/simplewallet.cpp
index 41665e4d8..b466251ab 100644
--- a/src/simplewallet/simplewallet.cpp
+++ b/src/simplewallet/simplewallet.cpp
@@ -997,7 +997,7 @@ bool simple_wallet::init(const boost::program_options::variables_map& vm)
return false;
}
cryptonote::blobdata viewkey_data;
- if(!epee::string_tools::parse_hexstr_to_binbuff(viewkey_string, viewkey_data))
+ if(!epee::string_tools::parse_hexstr_to_binbuff(viewkey_string, viewkey_data) || viewkey_data.size() != sizeof(crypto::secret_key))
{
fail_msg_writer() << tr("failed to parse view key secret key");
return false;
@@ -1049,7 +1049,7 @@ bool simple_wallet::init(const boost::program_options::variables_map& vm)
return false;
}
cryptonote::blobdata spendkey_data;
- if(!epee::string_tools::parse_hexstr_to_binbuff(spendkey_string, spendkey_data))
+ if(!epee::string_tools::parse_hexstr_to_binbuff(spendkey_string, spendkey_data) || spendkey_data.size() != sizeof(crypto::secret_key))
{
fail_msg_writer() << tr("failed to parse spend key secret key");
return false;
@@ -1065,7 +1065,7 @@ bool simple_wallet::init(const boost::program_options::variables_map& vm)
return false;
}
cryptonote::blobdata viewkey_data;
- if(!epee::string_tools::parse_hexstr_to_binbuff(viewkey_string, viewkey_data))
+ if(!epee::string_tools::parse_hexstr_to_binbuff(viewkey_string, viewkey_data) || viewkey_data.size() != sizeof(crypto::secret_key))
{
fail_msg_writer() << tr("failed to parse view key secret key");
return false;
@@ -3166,7 +3166,7 @@ bool simple_wallet::get_tx_key(const std::vector<std::string> &args_)
if (m_wallet->ask_password() && !get_and_verify_password()) { return true; }
cryptonote::blobdata txid_data;
- if(!epee::string_tools::parse_hexstr_to_binbuff(local_args.front(), txid_data))
+ if(!epee::string_tools::parse_hexstr_to_binbuff(local_args.front(), txid_data) || txid_data.size() != sizeof(crypto::hash))
{
fail_msg_writer() << tr("failed to parse txid");
return false;
@@ -3203,7 +3203,7 @@ bool simple_wallet::check_tx_key(const std::vector<std::string> &args_)
assert(m_wallet);
cryptonote::blobdata txid_data;
- if(!epee::string_tools::parse_hexstr_to_binbuff(local_args[0], txid_data))
+ if(!epee::string_tools::parse_hexstr_to_binbuff(local_args[0], txid_data) || txid_data.size() != sizeof(crypto::hash))
{
fail_msg_writer() << tr("failed to parse txid");
return true;
@@ -3219,7 +3219,7 @@ bool simple_wallet::check_tx_key(const std::vector<std::string> &args_)
}
crypto::secret_key tx_key;
cryptonote::blobdata tx_key_data;
- if(!epee::string_tools::parse_hexstr_to_binbuff(local_args[1], tx_key_data))
+ if(!epee::string_tools::parse_hexstr_to_binbuff(local_args[1], tx_key_data) || tx_key_data.size() != sizeof(crypto::secret_key))
{
fail_msg_writer() << tr("failed to parse tx key");
return true;
@@ -3851,7 +3851,7 @@ bool simple_wallet::set_tx_note(const std::vector<std::string> &args)
}
cryptonote::blobdata txid_data;
- if(!epee::string_tools::parse_hexstr_to_binbuff(args.front(), txid_data))
+ if(!epee::string_tools::parse_hexstr_to_binbuff(args.front(), txid_data) || txid_data.size() != sizeof(crypto::hash))
{
fail_msg_writer() << tr("failed to parse txid");
return false;
@@ -3879,7 +3879,7 @@ bool simple_wallet::get_tx_note(const std::vector<std::string> &args)
}
cryptonote::blobdata txid_data;
- if(!epee::string_tools::parse_hexstr_to_binbuff(args.front(), txid_data))
+ if(!epee::string_tools::parse_hexstr_to_binbuff(args.front(), txid_data) || txid_data.size() != sizeof(crypto::hash))
{
fail_msg_writer() << tr("failed to parse txid");
return false;
@@ -4179,7 +4179,7 @@ bool simple_wallet::show_transfer(const std::vector<std::string> &args)
}
cryptonote::blobdata txid_data;
- if(!epee::string_tools::parse_hexstr_to_binbuff(args.front(), txid_data))
+ if(!epee::string_tools::parse_hexstr_to_binbuff(args.front(), txid_data) || txid_data.size() != sizeof(crypto::hash))
{
fail_msg_writer() << tr("failed to parse txid");
return false;