Repository navigation
Conversation
sendPacket() serialised the packet into a 246-byte stack buffer with Packet::writeTo(), which takes no destination size, and only then checked whether it fitted. A packet can serialise to 254 bytes. Check getRawLength() first and write directly into the outgoing frame, which also drops the extra copy. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
ESPNowBridge::sendPacket()writes the packet into a 246-byte stack buffer withPacket::writeTo(), which takes no destination size, and only then checks whether it fitted. A packet can serialise to 254 bytes (64-byte path, 184-byte payload, transport codes). This checksgetRawLength()first and writes straight into the outgoing frame, which also drops the extra copy.#3038 described the same write-then-check as a packet-loss issue. On the current ESP32, ESP32-S3 and ESP32-C3 builds the compiler puts the outgoing
bufferright aftersizingBuffer, so the up-to-8-byte overrun lands in a buffer that isn't used yet; it's still undefined behaviour and depends on stack layout.Built for Heltec_WSL3_repeater_bridge_espnow and Heltec_v2_repeater_bridge_espnow; not tested on hardware. Written with Claude (AI), reviewed by me.
🤖 Generated with Claude Code