Simplify final returns from packDomainName

This commit is contained in:
Tom Thorogood 2018-11-26 15:07:17 +10:30
parent 926752f160
commit 9358e95aef
No known key found for this signature in database
GPG Key ID: 86C63CDA416C6D2F
1 changed files with 5 additions and 4 deletions

9
msg.go
View File

@ -321,13 +321,14 @@ loop:
// We have two bytes (14 bits) to put the pointer in
// if msg == nil, we will never do compression
binary.BigEndian.PutUint16(msg[off:], uint16(pointer^0xC000))
off++
} else if msg != nil && off < len(msg) {
return off + 2, labels, nil
}
if msg != nil && off < len(msg) {
msg[off] = 0
}
off++
return off, labels, nil
return off + 1, labels, nil
}
// Unpack a domain name.