mirror of
https://github.com/monero-project/monero.git
synced 2025-10-14 04:40:40 -04:00
simplewallet: validate hex input size
This commit is contained in:
parent
3f171b931f
commit
83ec209f42
5 changed files with 21 additions and 21 deletions
|
@ -1157,7 +1157,7 @@ void WalletImpl::setDefaultMixin(uint32_t arg)
|
|||
bool WalletImpl::setUserNote(const std::string &txid, const std::string ¬e)
|
||||
{
|
||||
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 ¬e)
|
|||
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 "";
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue