]> git.kaiwu.me - haproxy.git/commit
BUG/MINOR: resolvers: Always init a new resolution's list element
authorChristopher Faulet <cfaulet@haproxy.com>
Tue, 29 Sep 2026 07:29:21 +0000 (09:29 +0200)
committerChristopher Faulet <cfaulet@haproxy.com>
Tue, 10 Nov 2026 14:47:52 +0000 (15:47 +0100)
commit77be1f07882289b98b24a709298d87153a026928
tree2a2416c4843332575456620f751f2b24a93724ad
parent472a0ca440b6bb200b3ea3a23ba6ee10dbe8fa5f
BUG/MINOR: resolvers: Always init a new resolution's list element

resolv_pick_resolution() allocates a new resolution with pool_zalloc(),
then duplicates the hostname into it. If strdup() fails, the resolution
is released with resolv_free_resolution(), which ends with
LIST_DEL_INIT(&resolution->list). But this list element was not
initialized yet (it's only appended to the wait list once the hostname
was duplicated), so it contains NULL pointers which are dereferenced,
crashing the process instead of reporting the allocation failure.

This can only happen when running out of memory. Let's initialize the
list element with the other fields.

This was introduced in 3.3 by commit 6cf2401ed ("BUG/MEDIUM: resolvers:
Make resolution owns its hostname_dn value"), so this must be backported
wherever this commit was backported (so as far as 2.8).
src/resolvers.c