]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUG/MAJOR: resolvers: segfault using server template without SRV RECORDs
authorEmeric Brun <ebrun@haproxy.com>
Mon, 14 Jun 2021 08:02:18 +0000 (10:02 +0200)
committerChristopher Faulet <cfaulet@haproxy.com>
Mon, 14 Jun 2021 09:04:02 +0000 (11:04 +0200)
This patch fix the issue adding a test in srvrq before registering
the server on it during server template init.

This was a regression due to commit :
3406766d57fc11478d54a6fa2d048cbfe4524a4e

This should be backported with this previous commit (until 2.0)

src/server.c

index 30ee13530b7ac2a624ed3a1f4ea048cc9289a0f2..57b3feecb6683a6cf2126bbe2bd99327fca1afe3 100644 (file)
@@ -2306,7 +2306,8 @@ static int _srv_parse_tmpl_init(struct server *srv, struct proxy *px)
                }
 #endif
                /* append to list of servers available to receive an hostname */
-               LIST_APPEND(&newsrv->srvrq->attached_servers, &newsrv->srv_rec_item);
+               if (newsrv->srvrq)
+                       LIST_APPEND(&newsrv->srvrq->attached_servers, &newsrv->srv_rec_item);
 
                /* Set this new server ID. */
                _srv_parse_set_id_from_prefix(newsrv, srv->tmpl_info.prefix, i);