Also check when unpacking for domainnames > 255

This commit is contained in:
Miek Gieben 2012-12-06 10:55:31 +01:00
parent 4c6d89f727
commit ff22456520
1 changed files with 4 additions and 0 deletions

4
msg.go
View File

@ -331,6 +331,7 @@ func UnpackDomainName(msg []byte, off int) (s string, off1 int, err error) {
s = ""
lenmsg := len(msg)
ptr := 0 // number of pointers followed
offstart := off
Loop:
for {
if off >= lenmsg {
@ -391,6 +392,9 @@ Loop:
if ptr == 0 {
off1 = off
}
if off1 - offstart > 255 {
return "", lenmsg, ErrDomain
}
return s, off1, nil
}