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
This commit is contained in:
Miek Gieben 2015-07-27 20:48:09 +01:00
parent e59f851c91
commit c13d4ee9cd
1 changed files with 4 additions and 1 deletions

5
msg.go
View File

@ -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
}