Repository navigation
Conversation
octets_recvd is the length of the whole unprotected packet, header included, so copying that many bytes from message.body ran 12 bytes past the payload and left msg without a terminator. rtpw prints the result with %s and could read past its stack buffer.
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.
rtp_recvfrom() in test/rtp.c copies octets_recvd bytes out of message.body, but after srtp_unprotect() that count still includes the 12-byte RTP header, so it pulls in 12 bytes past the payload (the stripped tag plus whatever was left in the buffer) and never writes a terminator, while rtpw's receiver prints the 128-byte word buffer with %s. With rtpw running as
-r -e(no auth), a single 128-byte datagram for SSRC 0xdeadbeef was enough for ASan to report a stack-buffer-overflow READ onwordin a harness that calls rtp_recvfrom() the same way rtpw does. Copying only octets_recvd - RTP_HEADER_LEN bytes and null-terminating fixes it, and the terminator always fits because recvfrom() is already capped at *len; normal words still round-trip unchanged with conf+auth.