From c13d4ee9cdfa521fc0e297cc608e4e3133322ffa Mon Sep 17 00:00:00 2001 From: Miek Gieben Date: Mon, 27 Jul 2015 20:48:09 +0100 Subject: [PATCH] domain names: fix compression of root-label If the root label is compressed (which is 2 bytes, the root label itself is only 1 byte, so why do it?), go dns incorrectly set the offset when encountering such a name. Fixes #234 --- msg.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/msg.go b/msg.go index 34896a75c..9fb893574 100644 --- a/msg.go +++ b/msg.go @@ -414,7 +414,10 @@ Loop: if c == 0x00 { // end of name if len(s) == 0 { - return ".", off, nil + if ptr == 0 { + off1 = off + } + return ".", off1, nil } break Loop }