util.dns: Fix returning read position after zero-length name
authorKim Alvefur <zash@zash.se>
Sun, 04 Oct 2020 21:27:20 +0200
changeset 12243 578ce0415398
parent 12242 57215267dd4f
child 12244 ffd66b461f6a
util.dns: Fix returning read position after zero-length name Doesn't affect normal usage by Prosody since neither A nor AAAA records use this and SRV records has the host name last so the position is not needed.
util/dns.lua
--- a/util/dns.lua	Wed Feb 02 17:31:39 2022 +0100
+++ b/util/dns.lua	Sun Oct 04 21:27:20 2020 +0200
@@ -40,7 +40,7 @@
 
 -- No support for pointers, but libunbound appears to take care of that.
 local function readDnsName(packet, pos)
-	if s_byte(packet, pos) == 0 then return "."; end
+	if s_byte(packet, pos) == 0 then return ".", pos+1; end
 	local pack_len, r, len = #packet, {};
 	pos = pos or 1;
 	repeat