summaryrefslogtreecommitdiff
path: root/src/stdio/freopen.c
diff options
context:
space:
mode:
authorRich Felker <dalias@aerifal.cx>2022-09-22 19:11:48 -0400
committerRich Felker <dalias@aerifal.cx>2022-10-19 14:01:12 -0400
commit8c408937da4cb7f6460972a0f645694304de3c8c (patch)
tree8d60a3a0a2eb962842f2aa240c2641f775818ff5 /src/stdio/freopen.c
parent759bf785a84bd56ed1b163594f3f66ade808c0e3 (diff)
downloadmusl-8c408937da4cb7f6460972a0f645694304de3c8c.tar.gz
getaddrinfo dns lookup: use larger answer buffer to handle long CNAMEs
the size of 512 is not sufficient to get at least one address in the worst case where the name is at or near max length and resolves to a CNAME at or near max length. prior to tcp fallback, there was nothing we could do about this case anyway, but now it's fixable. the new limit 768 is chosen so as to admit roughly the number of addresses with a worst-case CNAME as could fit for a worst-case name that's not a CNAME in the old 512-byte limit. outside of this worst-case, the number of addresses that might be obtained is increased. MAXADDRS (48) was originally chosen as an upper bound on the combined number of A and AAAA records that could fit in 512-byte packets (31 and 17, respectively). it is not increased at this time. so as to prevent a situation where the A records consume almost all of these slots (at 768 bytes, a "best-case" name can fit almost 47 A records), the order of parsing is swapped to process AAAA first. this ensures roughly half of the slots are available to each address family.
Diffstat (limited to 'src/stdio/freopen.c')
0 files changed, 0 insertions, 0 deletions