From 14a60d420a66368a4262e8ecf259781292509659 Mon Sep 17 00:00:00 2001 From: Christopher Faulet Date: Wed, 3 Aug 2022 10:30:06 +0200 Subject: [PATCH] BUG/MEDIUM: dns: Properly initialize new DNS session 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 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/dns.c b/src/dns.c index 7a5ddae980..ee0353d10a 100644 --- 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;