Skip to content

net: reject oversized transport message types - #235

Closed
l0rinc wants to merge 56 commits into
masterfrom
l0rinc/net-reject-oversized-message-types
Closed

l0rinc wants to merge 56 commits into
masterfrom
l0rinc/net-reject-oversized-message-types

Conversation

@l0rinc

@l0rinc l0rinc commented Jul 20, 2026 •

Copy link
Copy Markdown
Owner

Problem: Transport::SetMessageToSend() assumes that an internal outbound message type fits its fixed 12-byte wire field.
V1 aborts on a longer name, while V2 writes past the end of its contents vector.
No remotely reachable caller is known: normal outbound messages use fixed NetMsgType values, and sendmsgtopeer already rejects names longer than 12 bytes.

Fix: Reject oversized names before either transport encodes them and leave the input message unchanged.
CConnman checks the same limit before queueing, so an invalid internal message cannot stall its send queue.
Unit tests cover the 12- and 13-byte boundaries for both transports and verify that rejected messages remain unchanged.

hebasto and others added 19 commits June 29, 2026 15:44
Some functional tests on non-Linux platforms rely on the `lsof` utility.
However, we treat all other functional test dependencies, such as
additional Python modules, as optional, and skip dependent tests if
those are unavailable.

This change makes `lsof` optional as well.
Modern NetBSD `ifconfig` prints interface addresses in CIDR notation
(e.g. `inet 127.0.0.1/8`), unlike the other supported platforms which
print the netmask as a separate field. The trailing prefix length breaks
functional tests that expect a plain IP address.

This change is a no-op on other platforms.
On NetBSD, `lsof` can produce the following warnings:
1. "created device cache file: ..." - usually happens in a CI
environment.
2. "compiled for NetBSD release 10.0; this is 10.1." or similar - when
the `lsof` binary package is installed on a point release.

This change suppresses both warnings printed to stderr and fixes the
affected tests.
This extends support for `get_bind_addrs` and `feature_bind_extra` to
illumos-based OSes.
When loading a transaction, instead of constructing a CWalletTx with no
transaction, pass the DataStream into the constructor so that the
CWalletTx is RAII. This allows us to ensure that the transaction is
never a nullptr so that dereferences, especially once multiple txs are
stored, will not cause a segfault.
When CWalletTx will have multiple transactions, tx will no longer exist
and accessing the single canonical tx should be done through an getter
function.
A transaction can have several valid witnesses that share its txid but
differ in wtxid, e.g. when a taproot output is spent via the key path
in one variant and the script path in another.

CWalletTx now keeps all of them in a map indexed by wtxid (m_txs) and
marks one as canonical (m_canonical_wtxid): a confirmed variant if there
is one, otherwise the one with a witness and the lowest weight. GetTx()
and serialization return the canonical variant, so existing callers
don't need to change.

The other variants are stored in their own wtxvariant records keyed by
(txid, wtxid) and merged back into the CWalletTx at load. The tx record
keeps its old format, holding the canonical transaction, so older soft
versions can still read and rewrite it without dropping those records.
Instead of replacing the tx when a witness alternative appears, add it
to the set of wtxid alternates.

In order to determine whether the added transaction is the canonical
transaction, Update also needs to know how the state is changing, so it
will also update the state if it is being changed.
If a wallet tranasction has alterate witness versions, list those wtxids
in gettransaction's output.
The setup loop inserts transactions through raw mapWallet.emplace(),
which does not populate m_txos. Since AvailableCoins and
FetchSelectedInputs now look up coins through m_txos, coin
selection is structurally unreachable.

Call RefreshTXOsFromTx after each insertion so the wallet's
TXO index reflects the inserted outputs.
@l0rinc
l0rinc force-pushed the l0rinc/net-reject-oversized-message-types branch from 0df817b to 7c4e917 Compare July 30, 2026 17:08
@l0rinc l0rinc closed this Jul 30, 2026
@l0rinc l0rinc reopened this Jul 30, 2026
furszy and others added 8 commits July 31, 2026 15:16
A peer should not request filtered blocks from a node that
does not advertise NODE_BLOOM. Perform this check before
looking up the block to avoid an unnecessary disk read.

Note: currently, the request is ignored only after the
block has been read from disk, in the bloom filter
existence check.
A getblocktxn msg is only needed when at least one tx is
missing from a compact block. If no txs are missing, the
block can be reconstructed without sending the request.

This avoids reading the requested block from disk
unnecessarily and also alerts the peer operator about
their node's buggy behavior.
Fix all IWYU warnings in `src/common` and treat them as errors in CI.

Additionally, ensure that our drop-in header replacements are used
instead of system headers:
- `<util/check.h>` instead of `<cassert>`
- `<util/time.h>` instead of `<chrono>`
Otherwise the build will fail with warnings about missing Python (removed
in the next commit). However the non-gui build does not need Python.

Note that bitcoin#25573 contains the same change, because the use of -static-pie
causes warnings when combined with our/CMakes own PIE handling.
l0rinc and others added 16 commits August 3, 2026 12:03
Detect total RAM once so automatic cache selection and the oversized-cache warning use the same value.
Database cache arithmetic now uses `uint64_t`, so return the byte count directly and remove the 32-bit `size_t` clamp.

Co-authored-by: stringintech <[email protected]>
-BEGIN VERIFY SCRIPT-
git grep -q '\bMIN_DBCACHE_BYTES\b' -- src && echo "Error: renamed dbcache byte constant already exists in src" && exit 1
git grep -l 'MIN_DB_CACHE' -- src | xargs perl -pi -e 's/\bMIN_DB_CACHE\b/MIN_DBCACHE_BYTES/g'
-END VERIFY SCRIPT-

Co-authored-by: optout <[email protected]>
Keep the total database cache bounds with `kernel::CacheSizes` so node and Kernel callers validate against the same range.
Add `btck_chainstate_manager_options_set_database_cache_bytes()` so Kernel callers can set the total database cache budget.
Use `uint64_t` for a fixed-width C API, reject values outside the architecture-specific range, and keep `DEFAULT_KERNEL_CACHE` as the fallback.
Apply the selected split to the block tree database and `LoadChainstate()`.

Co-authored-by: stickies-v <[email protected]>
Co-authored-by: w0xlt <[email protected]>
Co-authored-by: stringintech <[email protected]>
The alias is misleading because automatic selection can also return `HIGH_DEFAULT_DBCACHE`.
RAM detection controls automatic `-dbcache` selection, so fail the test when it is unavailable.
The NetBSD 11.0_RC6 archives are no longer available from cdn.netbsd.org. Update the cross-build SDK to the final 11.0 release.
The macOS and BSD cross-build jobs extract SDK archives fetched at runtime without checking their content.
Keep each expected digest beside the corresponding SDK version and verify every archive before extraction.
Create the OpenBSD library symlinks once after both archives are extracted, when all link targets are present.
It fails due to bitcoin#35853.

It can be added back when the issue is addressed.
…e riscv32 from GHA

fa06ea4 ci: Temporarily remove riscv32 config from GHA matrix (MarcoFalke)
873550b ci: verify cross-build SDK archives (Lőrinc)
2c87337 ci: update NetBSD cross-build SDK (Lőrinc)

Pull request description:

  Address a few CI failures in three commits:

  * The NetBSD SDK release candidate was removed, so the CI consistently fails. Fix it by bumping to a release.
  * Also, include SDK download hashes to catch stuff like rare bit flips due to cosmic rays.
  * The riscv32 config consistently fails with download errors as well. Temporarily remove it until issue bitcoin#35853 is fixed.

ACKs for top commit:
  hebasto:
    ACK fa06ea4.
  sedited:
    ACK fa06ea4

Tree-SHA512: 27c728f2a94386e4ef882757e1cc30ca8336c89775965d1a567dcac17681d9dd49547246f700969293ac8798e882489eb5c1b2b5fed4759c83d0f4463a592579
…m as errors

50145f6 ci, iwyu: Enforce warning-free `src/common` (Hennadii Stepanov)

Pull request description:

  This PR [continues](bitcoin#33725 (comment)) the ongoing effort to enforce IWYU warnings.

  See [Developer Notes](https://github.com/bitcoin/bitcoin/blob/master/doc/developer-notes.md#using-iwyu).

ACKs for top commit:
  maflcko:
    review ACK 50145f6 🌾

Tree-SHA512: c14f97d725429fed0860a608cdb53d9c6c5c36fb710f44357ba276d5507fb9b0d99ba6dac8d9a8b1ac404d9093ebffd9fb07ee5f68b4d276657d087c1f404a63
…maybe_unused]]`

0238aeb refactor: Annotate `MakeAndPushFeature` with `[[maybe_unused]]` (Hennadii Stepanov)

Pull request description:

  This is a follow-up to bitcoin#35221. The `MakeAndPushFeature` member function template has no callers yet, which [triggers](https://my.cdash.org/builds/3851810/build) `-Wunused-template` now that Clang 23 [enables](llvm/llvm-project#208001) it as part of `-Wall`.

  Related PRs:
   - bitcoin#35679
   - bitcoin#35737
   - bitcoin-core/minisketch#102

ACKs for top commit:
  maflcko:
    lgtm ACK 0238aeb
  sedited:
    ACK 0238aeb

Tree-SHA512: c8b639055d34ea431d5d5f4c85815b4c19b31d6ea7e4a0c05c8420a328503028eca465fb0803eff3d4bab2c782cb8038844d3f89680928791832488494bd95d4
b75eb93 guix: move python-minimal to GUI build (fanquake)
101400b guix: remove -Werror=dev (fanquake)

Pull request description:

  Somewhat of a followup to bitcoin#35537.

ACKs for top commit:
  maflcko:
    lgtm ACK b75eb93
  janb84:
    ACK b75eb93

Tree-SHA512: 6bd22b6294019692bd6fe42818589f8ee05513a0102c6f5164d1abe988477d88c2e387f39ddd2dbd45a21e12634c59cea21f3f0a0664b3674f67c772fcc7a886
28641fd p2p: reject empty getblocktxn requests (furszy)
9871fb7 p2p: reject filtered block inv early when bloom is disabled (furszy)
aaf9412 refactor: split p2p_getdata.py in sub-cases (furszy)

Pull request description:

  Reject requests that make the node read blocks from disk unnecessarily:

  * `getblocktxn` is meant to request the txs a peer is missing. When a
    peer sends a `getblocktxn` with an empty index vector, it isn't missing
    anything, so it shouldn't have sent the message in the first place.

  * The peer should not request a filtered block when the node does not
    advertise the `NODE_BLOOM` service. Filtered blocks are built from
    the bloom filter, which can be loaded only when the `NODE_BLOOM`
    service is offered.

  Both are disconnected now.

  Note: can be split in two PRs if preferred.

ACKs for top commit:
  151henry151:
    ACK 28641fd
  l0rinc:
    lightly tested ACK 28641fd
  mzumsande:
    Code Review ACK 28641fd
  winterrdog:
    tested ACK 28641fd
  sedited:
    ACK 28641fd

Tree-SHA512: 787ee0741fb797ea0898daab1bf3d7b3a21d91c9d940fc833e893806e95843e9d5a7a79a55ba67ac0f1550c08f2b6cee5ab2b625c082f56885ae795958cc608c
… assertion

756afe1 test: give each ValidateInputsStandardness case its own scope (JP)
5559fa4 test: fix wrong transaction in GetP2SHSigOpCount assertion (JP)

Pull request description:

  While reading through `script_p2sh_tests.cpp` I noticed one of the assertions in `ValidateInputsStandardness` checks the wrong transaction.

  The test builds `txToNonStd2_no_scriptSig` (which spends a P2SH prevout with an empty scriptSig) and checks its standardness result ("input 0 P2SH redeemscript missing"), but the `GetP2SHSigOpCount` assertion right after it re-checks the previous transaction: line 433 is byte-identical to line 419. Looks like a copy-paste slip from 248c175, which added a `GetP2SHSigOpCount` check after each constructed transaction.

  This PR points the assertion at `txToNonStd2_no_scriptSig` and expects 0 sigops. With an empty scriptSig there's no redeemScript push, so `GetSigOpCount(scriptSig)` ends up counting an empty subscript and returns 0. This case wasn't asserted anywhere before. The line above covers the other side, where the same prevout spent with the actual redeemScript counts 20.

  To make sure the fix isn't vacuous I also ran the assertion expecting 20, and it fails with `[0 != 20]`.

  Tested with:

  ```
  cmake --build build --target test_bitcoin
  build/bin/test_bitcoin --run_test=script_p2sh_tests
  ```

ACKs for top commit:
  l0rinc:
    ACK 756afe1
  sedited:
    ACK 756afe1

Tree-SHA512: 463eda7bb8790fb55619b36a6bedcd437f5c3d753e8c0abaa57dde3154421cde8c36f04293eb712ddf2745d525b5e254e8a1ab898f4f68538520dd80d873dba3
…nd *BSD

f4a6d07 qa: Support `get_bind_addrs` and `feature_bind_extra` on illumos (Hennadii Stepanov)
5e96a8f doc: Add `lsof` to Test Suite Dependencies on NetBSD (Hennadii Stepanov)
5d01aa4 qa: Ignore `lsof` warnings on NetBSD (Hennadii Stepanov)
70352fd qa: Strip prefix length from NetBSD `ifconfig` output (Hennadii Stepanov)
1c17355 doc: Add `lsof` to Test Suite Dependencies on FreeBSD (Hennadii Stepanov)
4cb7f39 qa: Drop OpenBSD from supported platforms in `get_bind_addrs` function (Hennadii Stepanov)
8a982ee qa: Add `skip_if_no_lsof_on_nonlinux` helper and use it where needed (Hennadii Stepanov)

Pull request description:

  This PR is a follow-up to bitcoin#34256. It extends functional test support to illumos-based OSes and fixes several related issues on the *BSDs.

  Changes:
  - Make `lsof` an optional functional test dependency via a new `skip_if_no_lsof` helper, consistent with other optional test deps.
  - Strip the CIDR prefix length from NetBSD `ifconfig` output (no-op on other platforms).
  - Suppress spurious `lsof` warnings on NetBSD.
  - Drop OpenBSD from the platforms supported by `get_bind_addrs`.
  - Document the `lsof` Test Suite Dependency for FreeBSD and NetBSD.
  - Add support for `get_bind_addrs` and `feature_bind_extra` on illumos.

  CI runs: hebasto/bitcoin-core-nightly#280.

  Addresses bitcoin#34256 (comment).

ACKs for top commit:
  l0rinc:
    Lightly tested code review ACK f4a6d07
  sedited:
    utACK f4a6d07

Tree-SHA512: 24d943d059f5fa3f5626017eff744836177a41724544355f34b3a31fdf287bd1916bc6e903b598c1c55b61da2ff0f931b4455542d9cff6cf399ef7963096dff4
sedited and others added 10 commits August 4, 2026 21:46
…faults

6a2de55 test: require `TryGetTotalRam()` detection (Lőrinc)
cd086c1 node, qt: inline `DEFAULT_DB_CACHE` (Lőrinc)
8bd9f46 kernel: allow setting chainstate `dbcache` (Lőrinc)
8aa21e1 kernel, node: colocate dbcache bounds (Lőrinc)
7cfa21d scripted-diff: use `MIN_DBCACHE_BYTES` (Lőrinc)
ab63432 common: cache total RAM as `uint64_t` (Lőrinc)
031fa40 scripted-diff: use `TryGetTotalRam` (Lőrinc)
41c44f5 node, qt: use `1_MiB` for dbcache conversions (Lőrinc)

Pull request description:

  **Problem:** Since bitcoin#34692, the node chooses a `450 MiB` or `1 GiB` database cache from detected RAM, while Kernel always uses `450 MiB`.
  The shared names obscure the difference between the node's automatic policy and Kernel's fixed fallback, and Kernel callers cannot set their own cache budget.

  **Fix:** Cache RAM detection as `uint64_t`, keep the node's two-tier default unchanged, and make the fixed Kernel fallback explicit.
  Add a chainstate-manager option setter that accepts a total database cache budget and applies the shared bounds and cache split.

ACKs for top commit:
  maflcko:
    review ACK 6a2de55 🚵
  stringintech:
    re-ACK 6a2de55
  sedited:
    ACK 6a2de55

Tree-SHA512: 4c92267647a757efb79e8396015de89290eed56c6ff109d9e81495f33ea68ccf90b77cb4b65412cd7825c29b6bf5384ac4ec77fc6c50fbf3e31ee82cf0b552f0
…ion:SaltedCoinsCacheHasher::operator()

fa7f553 test: Suppress implicit-unsigned-integer-truncation:SaltedCoinsCacheHasher::operator() (MarcoFalke)

Pull request description:

  The truncation of u64 to size_t is intentional here, but it would be nice to document that for ubsan.

  Otherwise, ubsan will print warnings about this. E.g. on 32-bit platforms:

  ```
  /ci_container_base/src/coins.h:255:16: runtime error: implicit conversion from type 'uint64_t' (aka 'unsigned long long') of value 18400304222395891501 (64-bit, unsigned) to type 'size_t' (aka 'unsigned int') changed the value to 2265382701 (32-bit, unsigned)
  ```

  This is a bit tedious to test on 64-bit platforms, but one can use a diff like:

  ```diff
  diff --git a/src/coins.h b/src/coins.h
  index c854893..906be9efae 100644
  --- a/src/coins.h
  +++ b/src/coins.h
  @@ -246,3 +246,3 @@ public:
       /** Hash a transaction ID, itself a cryptographic hash, as one jumbo block. */
  -    size_t operator()(const Txid& id) const noexcept
  +    uint32_t operator()(const Txid& id) const noexcept
       {
  @@ -252,3 +252,3 @@ public:
       /** Hash an outpoint as its txid jumbo block followed by the zero-extended index as one normal block. */
  -    size_t operator()(const COutPoint& id) const noexcept
  +    uint32_t operator()(const COutPoint& id) const noexcept
       {
  ```

  and:

  ```
  $ UBSAN_OPTIONS="suppressions=$(pwd)/test/sanitizer_suppressions/ubsan:print_stacktrace=1:halt_on_error=1:report_error_type=1" ./bld-cmake/bin/test_bitcoin

  ./src/coins.h:255:16: runtime error: implicit conversion from type 'uint64_t' (aka 'unsigned long') of value 17092028281225243117 (64-bit, unsigned) to type 'uint32_t' (aka 'unsigned int') changed the value to 291269101 (32-bit, unsigned)

ACKs for top commit:
  l0rinc:
    ACK fa7f553
  sedited:
    ACK fa7f553

Tree-SHA512: 0798e09a1291c7e7e2799c586f416b9e92ddf3ad64af3888a01726f338935f735c4e36716a7c38426e75ddbbdc2854949c3f553ab67758a053a2e3ba6a3c3ec1
Now that clamping to std::numeric_limits<size_t>::max() is removed, the limits include is no longer needed.

Similarly after changing size_t -> u64, the cstddef include needs to be replaced by cstdint.
fa7304f refactor: Remove unused #include in common/system (MarcoFalke)

Pull request description:

  (See commit msg)

  This should also fix CI issues, such as bitcoin#35885 (comment)

ACKs for top commit:
  hebasto:
    ACK fa7304f.

Tree-SHA512: 726aad3b79224ffc22c7db1bb7247d7a669eff5b43335c0d33c835848c2e6525e68759242d4f7cfd3c42734ce571e453d071064c6ae7b6c1d047538d0495de58
…_transaction

1eac6a7 fuzz: populate wallet TXO index in wallet_create_transaction (frankomosh)

Pull request description:

  A refactor in bitcoin#27286 seemingly caused a regression in this harness. Rewiring to `m_txos` from `mapWallet` makes the setup loop in `wallet_create_transaction`, which uses raw `mapWallet.emplace()`, to no longer see coins. Therefore, `GetTXO`/`GetTXOs` probably return empty. To make coin selection possible, this fix calls `RefreshTXOsFromTx` after each insertion.

  <details>
  <summary>Coverage diff on select functions</summary>

  `diff spend_cov_before.txt spend_cov_after.txt` on `src/wallet/spend.cpp`:

  ```diff
  -  748|      0|  if (auto bnb_result{SelectCoinsBnB(...)}) {
  +  748|  2.14k|  if (auto bnb_result{SelectCoinsBnB(...)}) {

  -  761|      0|  if (auto knapsack_result{KnapsackSolver(...)}) {
  +  761|  4.46k|  if (auto knapsack_result{KnapsackSolver(...)}) {

  -  766|      0|  if (auto cg_result{CoinGrinder(...)}) {
  +  766|  2.88k|  if (auto cg_result{CoinGrinder(...)}) {

  -  774|      0|  if (auto srd_result{SelectCoinsSRD(...)}) {
  +  774|  4.46k|  if (auto srd_result{SelectCoinsSRD(...)}) {

  -  845|      0|  auto op_selection_result = AutomaticCoinSelection(...);
  +  845|  1.27k|  auto op_selection_result = AutomaticCoinSelection(...);

  -  960|      0|  if (auto res{AttemptSelection(...)}) {
  +  960|  1.36k|  if (auto res{AttemptSelection(...)}) {

  - 1484|      0|  auto txr_grouped = CreateTransactionInternal(...);
  + 1484|    380|  auto txr_grouped = CreateTransactionInternal(...);
  ```

  </details>

ACKs for top commit:
  brunoerg:
    code review ACK 1eac6a7
  sedited:
    tACK 1eac6a7

Tree-SHA512: 9680332e7fca634af8c1526efb7f63c188be25dd40d3a3fdc1c2a54d982267fc2a3ddfd7a081225ffbfe51ce0281272998e6616a64d23e4d98a8e9005d19457f
fa5cbb8 uint256: Workaround GCC-14 stringop-overread bug in Compare (Ava Chow)
6c9d76d doc: release note for alternate_wtxids in gettransaction (Ava Chow)
99bdcb0 test: compat, ensure downgrade preserves tx witness variants (furszy)
ef2afc6 test: Test for wallet txs with alternate wtxids (Ava Chow)
2d55c7a wallet: Show alternate wtxids in gettransaction (Ava Chow)
0b1af01 wallet: Replace CWalletTx::SetTx with Update (Ava Chow)
56cf27d wallet: Store all witness variants of a transaction (furszy)
798ba6d wallet: Make CWalletTx::tx private and use CWalletTx::GetTx to access (Ava Chow)
72ebdd6 wallet: Remove unused CWalletTx CopyFrom and copy constructor (Ava Chow)
19af439 wallet: Deserialize directly in CWalletTx's ctor (Ava Chow)

Pull request description:

  When the wallet is presented with a transaction that has the same txid as one already known to the wallet, but has a different witness, instead of ignoring the transaction, store it alongside the known tx. This enables the wallet to be aware of all wtxid variants of its transactions. This also allows for the wallet to be able to calculate fees for replacements better as txs with different witnesses may have different feerates.

  Specifically, the wallet stores these alternates in `CWalletTx` and extends the existing `tx` record type to essentially have a vector of transactions appended to the record. In `CWalletTx`, the single transaction is replaced with a map of wtxid to transaction so that all witness variants can still be represented by a single `CWalletTx`. For all of the various things that need the tx from a `CWalletTx`, a single witness variant is chosen to be the canonical tx and returned by `GetTx()`. This canonical tx is written into the same place as the previous single tx was written to in the `tx` record so that wallets can be loaded into previous versions.

  To choose the canonical transaction, if any of the variants is confirmed, then that is the canonical one. Otherwise, the witness variant with the least weight is chosen.

  An additional change I've included is to make `CWalletTx` RAII. This simplifies some of the implementation and enforces the assumption that a `CWalletTx` always has a transaction.

  Lastly, `gettransaction` and `listtransaction` have a new field `alternate_wtxids` to inform users of the wtxids of the witness variants for a transaction, and of course, a test.

  Closes bitcoin#11240

ACKs for top commit:
  furszy:
    ACK fa5cbb8
  ajtowns:
    ACK fa5cbb8
  w0xlt:
    ACK fa5cbb8

Tree-SHA512: ee303b395ab7a0843969f9491f876f4472c6301e968d9db87312edf44f7447245e707dd544356371d5f32fe6a619ee6937c24f3b7899f7a8108090b425f22d8e
Cover the accepted 12-byte type and 4 MB payload boundaries for both outbound transports.
V2 accepts a 13-byte type when a non-empty payload keeps the copy in bounds.
The `connman` fuzzer stops at 12 bytes, and both transports accept a 4,000,001-byte payload while consuming the input message.

Extend the existing two-node `sendmsgtopeer` test to confirm the oversized payload is sent and makes the peer disconnect.
`Transport::SetMessageToSend()` encodes message types in a fixed 12-byte wire field.
V1 aborts on a longer name, while V2 can overwrite the first payload byte or write past its encoding buffer.

Reject oversized names before either transport encodes them and before `CConnman` queues them.
Verify both transports reject the message unchanged, and let the `connman` fuzzer exercise the first oversized length.

Normal outbound messages use fixed `NetMsgType` values, and `sendmsgtopeer` already rejects names longer than 12 bytes.
`ConnmanTestMsg::ReceiveMsgFrom()` asserted whenever the transport declined a message.
Return false for messages outside the wire limits so fuzz targets can exercise transport rejection without aborting.
Retain the assertion for every other queue failure.
Incoming transports reject payloads larger than 4 MB, while outbound transports accepted them.
The testing-only sendmsgtopeer RPC could send a 4,000,001-byte payload that made the peer disconnect.

Use one predicate to apply the payload limit before messages are queued or encoded, and log rejections from the void `PushMessage()` interface.
Return an RPC error from sendmsgtopeer.

The existing characterization now verifies that both transports reject the input unchanged, and the OSS-Fuzz input from bitcoin#35880 passes without a harness restriction.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants