clamp packet length in zyfer_receive to bound a_lastcode#29
Open
arib06 wants to merge 1 commit into
Open
Conversation
Collaborator
|
Thanks for the report, @arib06. Please consider filing a report at https://bugs.ntp.org./ This repo is currently out of date on GitHub, but I checked and this shortcoming persists in the latest code. |
Author
|
Will do, I'll file this at bugs.ntp.org with the details. For the record, I confirmed it with a standalone ASAN harness that mirrors the else-branch append: seed lencode=1 with a short '!' line, then feed a 220-byte packet. Unpatched that gives a heap-buffer-overflow WRITE of size 220 at the memcpy past the 128-byte a_lastcode; with the clamp it stops at lencode=127 and runs clean. Valid Zyfer input is a 29-byte timecode so it never reaches the clamp. Happy to leave this PR open or close it once the bug report is in, whichever you prefer. |
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.
clamp recv_length in zyfer_receive before appending to a_lastcode, otherwise a short leading '!' line that seeds a small lencode followed by a packet longer than the buffer's remaining space overruns the 128-byte a_lastcode (recv_length reaches up to RX_BUFF_SIZE), matching the length clamp already used in jupiter_receive.