]> git.ipfire.org Git - thirdparty/haproxy.git/commit
BUG/MINOR: server/event_hdl: properly handle AF_UNSPEC for INETADDR event
authorAurelien DARRAGON <adarragon@haproxy.com>
Fri, 1 Dec 2023 16:41:40 +0000 (17:41 +0100)
committerWilly Tarreau <w@1wt.eu>
Fri, 1 Dec 2023 19:43:42 +0000 (20:43 +0100)
commitc2cd6a419cd376e3291b461558ad5cb172b8c5d4
treee9eae281a3a59b89aae3c1bc58682b1b4e7dfbd6
parented3bc0bfdd8a0151d1be370cc051d005e6c80d19
BUG/MINOR: server/event_hdl: properly handle AF_UNSPEC for INETADDR event

It is possible that a server's addr family is temporarily set to AF_UNSPEC
even if we're certain to be in INET context (ipv4, ipv6).

Indeed, as soon as IP address resolving is involved, srv->addr family will
be set to AF_UNSPEC when the resolution fails (could happen at anytime).

However, _srv_event_hdl_prepare_inetaddr() wrongly assumed that it would
only be called with AF_INET or AF_INET6 families. Because of that, the
function will handle AF_UNSPEC address as an IPV6 address: not only
we could risk reading from an unititialized area, but we would then
propagate false information when publishing the event.

In this patch we make sure to properly handle the AF_UNSPEC family in
both the "prev" and the "next" part for SERVER_INETADDR event and that
every members are explicitly initialized.

This bug was introduced by 6fde37e046 ("MINOR: server/event_hdl: add
SERVER_INETADDR event"), no backport needed.
include/haproxy/server-t.h
src/server.c