]> git.ipfire.org Git - thirdparty/haproxy.git/commit
BUG/MEDIUM: dns: fix long loops in additional records parse on name failure
authorWilly Tarreau <w@1wt.eu>
Thu, 14 May 2026 22:16:35 +0000 (22:16 +0000)
committerWilly Tarreau <w@1wt.eu>
Fri, 15 May 2026 13:26:49 +0000 (15:26 +0200)
commitfefce297ab5d0c36d6d6773092c976ea6166dc1e
tree2cc7b2a7abea592d734083c575e793772aacfbbb
parentbcb4f9cd4a2a779e4b289bf218ee35b84ccef760
BUG/MEDIUM: dns: fix long loops in additional records parse on name failure

In resolv_validate_dns_response(), the additional records loop calls
resolv_read_name(). When it returns zero due to a bad response, the main
loop does a "continue" without making the "reader" pointer progress, so it
evaluates the exact same field again and again. Fortunately this is limited
by arcount which is 16 bits, but it means it can still iterate 65535 times
there, allocating and releasing an answer_record at each turn. Let's just
jump to the invalid_resp label that handles the cleaning. There was the
same pattern (without the allocation) with nscount a few lines above BTW.
These can possibly explain some situations where a high CPU usage observed
processing responses.

Seems like these were introduced in 2.2 with commit 37950c8d2
("BUG/MEDIUM: dns: improper parsing of aditional records")

This must be backported to stable versions.
src/resolvers.c