Skip to content

wiz_socket: fix rx ring buffer wrap#11

Open
chall37 wants to merge 1 commit into
dsandy12:devfrom
chall37:fix/wiz-rxbuf-wrap
Open

wiz_socket: fix rx ring buffer wrap#11
chall37 wants to merge 1 commit into
dsandy12:devfrom
chall37:fix/wiz-rxbuf-wrap

Conversation

@chall37

@chall37 chall37 commented May 5, 2026

Copy link
Copy Markdown

In the wrap-around branch of getFromRealSocket() and loopback(), the second memcpy uses &rxbuf (the address of the rxbuf pointer) instead of rxbuf (the buffer it points to). &rxbuf[idx] is a pointer to byte idx of the buffer. &rxbuf is the address of the rxbuf member. This results in OOB writes and/or data corruption of the socket's own members.

Reproducible with DHCP loopback across repeated AVR resets in a single simulavr session (~3-4 cycles should be enough to trip it).

In the wrap-around branch of getFromRealSocket() and loopback(), the
second memcpy uses `&rxbuf` (the address of the rxbuf pointer) instead
of `rxbuf` (the buffer it points to).  `&rxbuf[idx]` is a pointer to
byte idx of the buffer.  `&rxbuf` is the address of the rxbuf member.
This results in OOB writes and/or data corruption of the socket's own
members.

Reproducible with DHCP loopback across repeated AVR resets in a single
simulavr session (~3-4 cycles should be enough to trip it).
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