Skip to content

Fix heap buffer overflow in UDP engine out_event()#4906

Open
TristanInSec wants to merge 1 commit into
zeromq:masterfrom
TristanInSec:fix/udp-out-buffer-overflow
Open

Fix heap buffer overflow in UDP engine out_event()#4906
TristanInSec wants to merge 1 commit into
zeromq:masterfrom
TristanInSec:fix/udp-out-buffer-overflow

Conversation

@TristanInSec

Copy link
Copy Markdown

The out_event() send path copies group_size + body_size + 1 bytes into the fixed MAX_UDP_MSG (8192) byte _out_buffer without checking if the total exceeds the buffer capacity. Messages with body larger than approximately 7936 bytes overflow the buffer and corrupt adjacent heap memory.

This adds a bounds check before the memcpy calls, discarding oversized messages. Resolves the TODO comment that acknowledged the missing check.

The out_event() send path copies group_size + body_size + 1 bytes
into the fixed MAX_UDP_MSG (8192) byte _out_buffer without checking
if the total exceeds the buffer capacity. Messages with body larger
than approximately 7936 bytes overflow the buffer and corrupt
adjacent heap memory.

Add a bounds check before the memcpy calls, discarding oversized
messages. This resolves the TODO comment that acknowledged the
missing check.

Signed-off-by: Tristan Music <tristmd@gmail.com>
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.

1 participant