]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUG/MEDIUM: dns: Properly initialize new DNS session
authorChristopher Faulet <cfaulet@haproxy.com>
Wed, 3 Aug 2022 08:30:06 +0000 (10:30 +0200)
committerChristopher Faulet <cfaulet@haproxy.com>
Wed, 3 Aug 2022 08:30:07 +0000 (10:30 +0200)
When a new DNS session is created, all its fields are not properly
initialized. For instance, "tx_msg_offset" can have any value after the
allocation. So, to fix the bug, pool_zalloc() is now used to allocate new
DNS session.

This patch should fix the issue #1781. It must be backported as far as 2.4.

src/dns.c

index 7a5ddae980c595c9fc647dbb35c9566a8c5b8ab5..ee0353d10a0ae4e7f0490dfeff31aee8f06d2305 100644 (file)
--- a/src/dns.c
+++ b/src/dns.c
@@ -1049,7 +1049,7 @@ struct dns_session *dns_session_new(struct dns_stream_server *dss)
        if (dss->maxconn && (dss->maxconn <= dss->cur_conns))
                return NULL;
 
-       ds = pool_alloc(dns_session_pool);
+       ds = pool_zalloc(dns_session_pool);
        if (!ds)
                return NULL;