From 6a66ae0d7c952484d9db0af591ffd7f571400d23 Mon Sep 17 00:00:00 2001 From: Neil Kettle Date: Fri, 6 Mar 2026 12:27:52 +0000 Subject: [PATCH] Fix buffer overflow in parsing ipv6 ptr querys Signed-off-by: Neil Kettle --- dns.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/dns.c b/dns.c index e2db851..2d53481 100644 --- a/dns.c +++ b/dns.c @@ -452,15 +452,22 @@ match_ipv6_addresses(char *reverse_ip, struct in6_addr *intf_ip) continue; if (j == 4) { + if (idx == sizeof temp_ip - 1) + break; temp_ip[idx] = ':'; idx++; j = 0; } + + if (idx == sizeof temp_ip - 1) + break; temp_ip[idx] = reverse_ip[i]; idx++; j++; } + temp_ip[idx] = '\0'; + if (inet_pton(AF_INET6, temp_ip, &buf) <= 0) return 0;