[Bug network/14806] New: stack overflow in getaddrinfo() when host has many addresses
mkubecek at suse dot cz
sourceware-bugzilla@sourceware.org
Mon Nov 5 13:48:00 GMT 2012
http://sourceware.org/bugzilla/show_bug.cgi?id=14806
Bug #: 14806
Summary: stack overflow in getaddrinfo() when host has many
addresses
Product: glibc
Version: unspecified
Status: NEW
Severity: normal
Priority: P2
Component: network
AssignedTo: unassigned@sourceware.org
ReportedBy: mkubecek@suse.cz
Classification: Unclassified
Created attachment 6720
--> http://sourceware.org/bugzilla/attachment.cgi?id=6720
proposed fix
Function make_request() in sysdeps/unix/sysv/linux/check_pf.c uses alloca() to
allocate memory for the temporary linked list of local addresses. If the host
has many addresses (originally observed with more than 7000 addresses and 256
KB stack size limit), this can cause stack overflow.
Attached is a fix proposal which is a bit more complicated than necessary but I
wanted to avoid
(1) calling malloc() in the most common case when there are just a few
addresses
(2) allocating many small blocks if there are many addresses
(3) allocating too much memory on stack
Thus the patch allocates a small block for 16 addresses on stack; if this is
not enough (usually it is), linked list of blocks for 64 addresses is allocated
as needed (suitable values of 16 and 64 are open to discussion).
--
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.
More information about the Glibc-bugs
mailing list