Merge lenmsg checks in packDomainName

This commit is contained in:
Tom Thorogood 2018-11-26 14:53:33 +10:30
parent 3534784466
commit ecef32b31b
No known key found for this signature in database
GPG Key ID: 86C63CDA416C6D2F
1 changed files with 1 additions and 4 deletions

5
msg.go
View File

@ -251,7 +251,7 @@ loop:
}
// off can already (we're in a loop) be bigger than len(msg)
// this happens when a name isn't fully qualified
if off+1 > lenmsg {
if off+1+(i-begin) > lenmsg {
return lenmsg, labels, ErrBuf
}
if msg != nil {
@ -259,9 +259,6 @@ loop:
}
offset := off
off++
if off+(i-begin) > lenmsg {
return lenmsg, labels, ErrBuf
}
if msg != nil {
if bs == nil {
copy(msg[off:], s[begin:i])