Skip to content

examples: fix unix client buffer handling - #19

Merged
oreparaz merged 1 commit into
mainfrom
oscar/fix-unix-recv-buffer
Jun 15, 2026
Merged

oreparaz merged 1 commit into
mainfrom
oscar/fix-unix-recv-buffer

Conversation

@oreparaz

Copy link
Copy Markdown
Owner

The unix example was passing sizeof recv_buffer * sizeof recv_buffer[0] to both recv() and vrt_parse_response(). That advertises a 4 KiB buffer for a 1 KiB stack allocation, then lets the parser read past the received packet.

This PR uses sizeof recv_buffer for the socket read, passes the actual received length to the parser, and switches hostname resolution to getaddrinfo() to avoid the sanitizer-visible misaligned hostent address copy.

Tested with:

  • cd tests/unit && ./compile.sh
  • cd examples && ./compile.sh

@oreparaz
oreparaz marked this pull request as ready for review June 15, 2026 13:48
@oreparaz
oreparaz merged commit b633661 into main Jun 15, 2026
9 checks passed
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