aboutsummaryrefslogtreecommitdiff
path: root/src/test/txpackage_tests.cpp
diff options
context:
space:
mode:
authorHodlinator <172445034+hodlinator@users.noreply.github.com>2024-07-12 13:26:55 +0200
committerHodlinator <172445034+hodlinator@users.noreply.github.com>2024-07-23 14:51:39 +0200
commit09ce3501fa2ea2885a857e380eddb74605f7038c (patch)
treeb9dd03cae8f411d9d13039e918678151b21d8258 /src/test/txpackage_tests.cpp
parent01e314ce0ae30228742b6f19d2f12a050ab97e4d (diff)
fix: Make TxidFromString() respect string_view length
Prior to this, passing string_view::data() into uint256S() meant the latter would only receive the a naked char* pointer and potentially scan past the string_view::length() until it found a null terminator (or some other non-hex character). Appears to have been a fully dormant bug as callers were either passing a string literal or std::string directly to TxidFromFromString(), meaning null terminator always existed at pointer[length()]. Bug existed since original merge of TxidFromString(), discussed in https://github.com/bitcoin/bitcoin/pull/28922#discussion_r1404437378.
Diffstat (limited to 'src/test/txpackage_tests.cpp')
-rw-r--r--src/test/txpackage_tests.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/test/txpackage_tests.cpp b/src/test/txpackage_tests.cpp
index 8c873c85a3..f16c0cdafd 100644
--- a/src/test/txpackage_tests.cpp
+++ b/src/test/txpackage_tests.cpp
@@ -47,7 +47,7 @@ inline CTransactionRef create_placeholder_tx(size_t num_inputs, size_t num_outpu
// Create a Wtxid from a hex string
inline Wtxid WtxidFromString(std::string_view str)
{
- return Wtxid::FromUint256(uint256S(str.data()));
+ return Wtxid::FromUint256(uint256S(str));
}
BOOST_FIXTURE_TEST_CASE(package_hash_tests, TestChain100Setup)