aboutsummaryrefslogtreecommitdiff
path: root/src/wallet/api
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/wallet/api
parentMerge pull request #1719 (diff)
downloadmonero-83ec209f42f02deab973254231efeb794edf2c16.tar.xz
simplewallet: validate hex input size
Diffstat (limited to 'src/wallet/api')
-rw-r--r--src/wallet/api/wallet.cpp6
-rw-r--r--src/wallet/api/wallet_manager.cpp4
2 files changed, 5 insertions, 5 deletions
diff --git a/src/wallet/api/wallet.cpp b/src/wallet/api/wallet.cpp
index c46de6b06..326ca26a0 100644
--- a/src/wallet/api/wallet.cpp
+++ b/src/wallet/api/wallet.cpp
@@ -1157,7 +1157,7 @@ void WalletImpl::setDefaultMixin(uint32_t arg)
bool WalletImpl::setUserNote(const std::string &txid, const std::string &note)
{
cryptonote::blobdata txid_data;
- if(!epee::string_tools::parse_hexstr_to_binbuff(txid, txid_data))
+ if(!epee::string_tools::parse_hexstr_to_binbuff(txid, txid_data) || txid_data.size() != sizeof(crypto::hash))
return false;
const crypto::hash htxid = *reinterpret_cast<const crypto::hash*>(txid_data.data());
@@ -1168,7 +1168,7 @@ bool WalletImpl::setUserNote(const std::string &txid, const std::string &note)
std::string WalletImpl::getUserNote(const std::string &txid) const
{
cryptonote::blobdata txid_data;
- if(!epee::string_tools::parse_hexstr_to_binbuff(txid, txid_data))
+ if(!epee::string_tools::parse_hexstr_to_binbuff(txid, txid_data) || txid_data.size() != sizeof(crypto::hash))
return "";
const crypto::hash htxid = *reinterpret_cast<const crypto::hash*>(txid_data.data());
@@ -1178,7 +1178,7 @@ std::string WalletImpl::getUserNote(const std::string &txid) const
std::string WalletImpl::getTxKey(const std::string &txid) const
{
cryptonote::blobdata txid_data;
- if(!epee::string_tools::parse_hexstr_to_binbuff(txid, txid_data))
+ if(!epee::string_tools::parse_hexstr_to_binbuff(txid, txid_data) || txid_data.size() != sizeof(crypto::hash))
{
return "";
}
diff --git a/src/wallet/api/wallet_manager.cpp b/src/wallet/api/wallet_manager.cpp
index 4104e7884..6feec75bd 100644
--- a/src/wallet/api/wallet_manager.cpp
+++ b/src/wallet/api/wallet_manager.cpp
@@ -182,7 +182,7 @@ bool WalletManagerImpl::checkPayment(const std::string &address_text, const std:
{
error = "";
cryptonote::blobdata txid_data;
- if(!epee::string_tools::parse_hexstr_to_binbuff(txid_text, txid_data))
+ if(!epee::string_tools::parse_hexstr_to_binbuff(txid_text, txid_data) || txid_data.size() != sizeof(crypto::hash))
{
error = tr("failed to parse txid");
return false;
@@ -196,7 +196,7 @@ bool WalletManagerImpl::checkPayment(const std::string &address_text, const std:
}
crypto::secret_key tx_key;
cryptonote::blobdata tx_key_data;
- if(!epee::string_tools::parse_hexstr_to_binbuff(txkey_text, tx_key_data))
+ if(!epee::string_tools::parse_hexstr_to_binbuff(txkey_text, tx_key_data) || tx_key_data.size() != sizeof(crypto::hash))
{
error = tr("failed to parse tx key");
return false;