Repository navigation
Conversation
The DTMF worker formats the notification into a 512-byte stack buffer with snprintf() and then uses snprintf()'s return value as notify_tag.len. That value is the length the string would have needed, not the length that fit. The tag is an argument of the M subcommand of a U or L command, and command arguments are substrings of the 8 kB command buffer with no length cap of their own, so for a tag of around 500 bytes or more rtpp_notify_schedule() memcpy()s past buf and do_notification() sends whatever followed it on the module thread's stack to the notification target. Clamp the length to the buffer, so an over-long tag is truncated instead of being read past.
sobomax
force-pushed
the
dtmf-notify-len-clamp
branch
from
November 30, 2026 22:33
3aa38a0 to
43b1c82
Compare
After the final statistics are taken, run an extra session per mode on the same daemons, recorder and notification client, with a 512-byte callee tag. The existing replay and its notification checks are unchanged. Each mode must deliver six exact 511-byte notifications.
sobomax
force-pushed
the
dtmf-notify-len-clamp
branch
from
November 30, 2026 22:41
43b1c82 to
96f3582
Compare
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.
Repro: run with
-n tcp:127.0.0.1:<nport>and the catch_dtmf module, sendU <cid> 127.0.0.1 <rport> ftag tcp:127.0.0.1:<nport> dtag && M3:1 <600-byte tag> 101followed by anL, then send a telephone-event start/end pair (same RTP ts, end bit set on the second) to the port theUreturned.Cause: the worker sets
notify_tag.lenfrom snprintf()'s return value, which is the length the notification would have needed rather than the length that fit in the 512-bytebuf. A command argument can be most of the 8 kB command buffer, sortpp_notify_schedule()memcpy()s pastbufanddo_notification()sends the bytes that followed it on the module thread's stack to the notification target.Fix: clamp the length to the buffer before building the string that gets handed on.
Built with
-fsanitize=address, before the change:After it the same run delivers a 511-byte notification with no report, a short tag comes out byte for byte as before, and
tests/catch_dtmf/basicpasses unchanged.