aboutsummaryrefslogtreecommitdiff
path: root/src/simplewallet/simplewallet.cpp
diff options
context:
space:
mode:
authormoneromooo-monero <moneromooo-monero@users.noreply.github.com>2017-02-14 19:35:44 +0000
committermoneromooo-monero <moneromooo-monero@users.noreply.github.com>2017-02-14 19:45:46 +0000
commit83ec209f42f02deab973254231efeb794edf2c16 (patch)
tree32ed00a75bce1b2f3c6611400dca7a2537367351 /src/simplewallet/simplewallet.cpp
parentMerge pull request #1719 (diff)
downloadmonero-83ec209f42f02deab973254231efeb794edf2c16.tar.xz
simplewallet: validate hex input size
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;