]> git.kaiwu.me - haproxy.git/commit
BUG/MINOR: server: better handling of OOM in srv_set_fqdn()
authorWilly Tarreau <w@1wt.eu>
Fri, 15 May 2026 14:55:07 +0000 (16:55 +0200)
committerWilly Tarreau <w@1wt.eu>
Fri, 15 May 2026 15:39:25 +0000 (17:39 +0200)
commit6c663a93746532086f7913d3968ce16c4542b4fb
treecebd9ab7362030bee6a711762cb2512ba8c5a9fc
parent2a43a1306b97bdb46dd26ac57e90d68f61de2956
BUG/MINOR: server: better handling of OOM in srv_set_fqdn()

This function may face an OOM on strdup() in the middle of the hostname
or hostname_dn replacement, leaving NULLs in either or both of the server's
fields, which is definitely not good for other call places.

Let's perform a safe replacement instead: we first allocate the new
values, and only if they are successful, then we release the previous
ones and replace them.

It is not necessary to backport this unless the issue is reported (it
was found via code review).
src/server.c