Skip to content

Commit

Permalink
domain names: fix compression of root-label
Browse files Browse the repository at this point in the history
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 miekg#234
  • Loading branch information
miekg committed Jul 27, 2015
1 parent e59f851 commit c13d4ee
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion msg.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down

0 comments on commit c13d4ee

Please sign in to comment.