From 9486a0f04406bc0a525965f3fca9b2ad88271f4e Mon Sep 17 00:00:00 2001 From: Murtaza Aliakbar Date: Wed, 4 Oct 2023 19:46:00 +0530 Subject: [PATCH] dnsutil: extractMDNSService out-of-bounds --- intra/xdns/dnsutil.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/intra/xdns/dnsutil.go b/intra/xdns/dnsutil.go index 08ec0316..e9657343 100644 --- a/intra/xdns/dnsutil.go +++ b/intra/xdns/dnsutil.go @@ -1049,7 +1049,7 @@ func extractMDNSDomain(qname string) (svc, tld string) { tldarpa4 := strings.LastIndex(qname, arpa4suffix) tldarpa6 := strings.LastIndex(qname, arpa6suffix) tldlocal := strings.LastIndex(qname, localsuffix) - if tldlocal == len(qname)-len(localsuffix) { + if tldlocal > 0 && tldlocal == len(qname)-len(localsuffix) { svc = qname[:tldlocal-1] // remove trailing dot; example. -> example tld = localsuffix } else if tldarpa4 > 0 {