aboutsummaryrefslogtreecommitdiff
path: root/doc/multisig-tutorial.md
diff options
context:
space:
mode:
authorMarcoFalke <falke.marco@gmail.com>2022-03-10 10:08:43 +0100
committerMarcoFalke <falke.marco@gmail.com>2022-03-10 10:24:05 +0100
commit5e33620ad81363d817a0050f29c68e4c3cf594b5 (patch)
treeb593c7687e20ffff3d842a960ef644eb19a1dca4 /doc/multisig-tutorial.md
parent430acb7d2a3272977d5a66bf9a09bcd55ffd15cc (diff)
parenta84650ebd5ac2cbb49f14eb7c98736a3f8215bf1 (diff)
downloadbitcoin-5e33620ad81363d817a0050f29c68e4c3cf594b5.tar.xz
Merge bitcoin/bitcoin#24371: util: Fix `ReadBinaryFile` reading beyond maxsize
a84650ebd5ac2cbb49f14eb7c98736a3f8215bf1 util: Fix ReadBinaryFile reading beyond maxsize (klementtan) Pull request description: Currently `ReadBinaryFile` will read beyond `maxsize` if `maxsize` is not a multiple of `128` (size of buffer) This is due to `fread` being called with `count = 128` instead of `count = min(128, maxsize - retval.size()` at every iteration The following unit test will fail: ```cpp BOOST_AUTO_TEST_CASE(util_ReadWriteFile) { fs::path tmpfolder = m_args.GetDataDirBase(); fs::path tmpfile = tmpfolder / "read_binary.dat"; std::string expected_text(300,'c'); { std::ofstream file{tmpfile}; file << expected_text; } { // read half the contents in file auto [valid, text] = ReadBinaryFile(tmpfile, expected_text.size() / 2); BOOST_CHECK_EQUAL(text.size(), 150); } } ``` Error: ``` test/util_tests.cpp:2593: error: in "util_tests/util_ReadWriteFile": check text.size() == 150 has failed [256 != 150] ``` ACKs for top commit: laanwj: Code review ACK a84650ebd5ac2cbb49f14eb7c98736a3f8215bf1 theStack: Code-review ACK a84650ebd5ac2cbb49f14eb7c98736a3f8215bf1 Tree-SHA512: 752eebe58bc2102dec199b6775f8c3304d899f0ce36d6a022a58e27b076ba945ccd572858b19137b769effd8c6de73a9277f641be24dfb17657fb7173ea0eda0
Diffstat (limited to 'doc/multisig-tutorial.md')
0 files changed, 0 insertions, 0 deletions