]> git.ipfire.org Git - thirdparty/haproxy.git/commit
BUG/MEDIUM: server: segv when adding server with hostname from CLI
authorAurelien DARRAGON <adarragon@haproxy.com>
Fri, 16 Sep 2022 12:27:53 +0000 (14:27 +0200)
committerWilly Tarreau <w@1wt.eu>
Sat, 17 Sep 2022 04:30:59 +0000 (06:30 +0200)
commit8d0ff284064e7a47ae46897e0ce9b08abe539315
tree87f5c75c9395ccca1e63045256aeee45dee48ee4
parente3e31212279f94d284c58ab83f7bd5c92b00b579
BUG/MEDIUM: server: segv when adding server with hostname from CLI

When calling 'add server' with a hostname from the cli (runtime),
str2sa_range() does not resolve hostname because it is purposely
called without PA_O_RESOLVE flag.

This leads to 'srv->addr_node.key' being NULL. According to Willy it
is fine behavior, as long as we handle it properly, and is already
handled like this in srv_set_addr_desc().

This patch fixes GH #1865 by adding an extra check before inserting
'srv->addr_node' into 'be->used_server_addr'. Insertion and removal
will be skipped if 'addr_node.key' is NULL.

It must be backported to 2.6 and 2.5 only.
src/server.c