diff options
author | moneromooo-monero <moneromooo-monero@users.noreply.github.com> | 2020-07-29 17:40:46 +0000 |
---|---|---|
committer | moneromooo-monero <moneromooo-monero@users.noreply.github.com> | 2020-07-30 22:52:14 +0000 |
commit | 13eee1d6abb035232acee3d757137d154f0ebb94 (patch) | |
tree | 964c4e538bc6735f10924a9a08a093b0ccd22268 /src/rpc/core_rpc_server.cpp | |
parent | easylogging++: fix crash with reentrant logging (diff) | |
download | monero-13eee1d6abb035232acee3d757137d154f0ebb94.tar.xz |
rpc: reject wrong sized txid
Reporter requested credit to be given to Decred
Diffstat (limited to '')
-rw-r--r-- | src/rpc/core_rpc_server.cpp | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/src/rpc/core_rpc_server.cpp b/src/rpc/core_rpc_server.cpp index bc561abc4..c1a70c570 100644 --- a/src/rpc/core_rpc_server.cpp +++ b/src/rpc/core_rpc_server.cpp @@ -2453,14 +2453,13 @@ namespace cryptonote { for (const auto &str: req.txids) { - cryptonote::blobdata txid_data; - if(!epee::string_tools::parse_hexstr_to_binbuff(str, txid_data)) + crypto::hash txid; + if(!epee::string_tools::hex_to_pod(str, txid)) { failed = true; } else { - crypto::hash txid = *reinterpret_cast<const crypto::hash*>(txid_data.data()); txids.push_back(txid); } } @@ -2805,15 +2804,14 @@ namespace cryptonote res.status = ""; for (const auto &str: req.txids) { - cryptonote::blobdata txid_data; - if(!epee::string_tools::parse_hexstr_to_binbuff(str, txid_data)) + crypto::hash txid; + if(!epee::string_tools::hex_to_pod(str, txid)) { if (!res.status.empty()) res.status += ", "; res.status += std::string("invalid transaction id: ") + str; failed = true; continue; } - crypto::hash txid = *reinterpret_cast<const crypto::hash*>(txid_data.data()); cryptonote::blobdata txblob; if (m_core.get_pool_transaction(txid, txblob, relay_category::legacy)) |