Skip to content

[COPY OF #24434] pp_accept: fix potential out-of-bounds read on oversized accept() addrlen#24447

Open
crystarm wants to merge 1 commit into
Perl:bleadfrom
crystarm:fix/pp-accept-clamp-addrlen
Open

[COPY OF #24434] pp_accept: fix potential out-of-bounds read on oversized accept() addrlen#24447
crystarm wants to merge 1 commit into
Perl:bleadfrom
crystarm:fix/pp-accept-clamp-addrlen

Conversation

@crystarm
Copy link
Copy Markdown

@crystarm crystarm commented May 29, 2026

COPY OF #24434

Summary: This PR fixes a potential out-of-bounds read in pp_accept (pp_sys.c).

Problem: PerlSock_accept_cloexec() (via accept()/accept4()) can return an addrlen larger than the supplied buffer size when the peer address is truncated. The previous code used the returned len directly in PUSHp(namebuf, len).

Fix: Clamp len to sizeof(namebuf) before calling PUSHp.

Impact: No behavior change for valid lengths. Prevents reading past namebuf when addrlen is oversized.

Context: Change was motivated by static analysis finding. BUFFER_OVERFLOW.PROC pp_sys.c:[2631:10].log

This set of changes does not require a perldelta entry.

@crystarm crystarm changed the title pp_accept: fix potential out-of-bounds read on oversized accept() addrlen [COPY OF THE #24434] pp_accept: fix potential out-of-bounds read on oversized accept() addrlen May 29, 2026
@crystarm crystarm changed the title [COPY OF THE #24434] pp_accept: fix potential out-of-bounds read on oversized accept() addrlen [COPY OF #24434] pp_accept: fix potential out-of-bounds read on oversized accept() addrlen May 29, 2026
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