Move bs allocation above length check in packDomainName

This commit is contained in:
Tom Thorogood 2018-11-26 16:15:50 +10:30
parent 7f4b3bb806
commit 149f3c884f
No known key found for this signature in database
GPG Key ID: 86C63CDA416C6D2F
1 changed files with 4 additions and 4 deletions

8
msg.go
View File

@ -229,14 +229,14 @@ loop:
switch c {
case '\\':
if bs == nil {
bs = []byte(s)
}
if off+1 > lenmsg {
return lenmsg, labels, ErrBuf
}
if bs == nil {
bs = []byte(s)
}
// check for \DDD
if i+3 < ls && isDigit(bs[i+1]) && isDigit(bs[i+2]) && isDigit(bs[i+3]) {
bs[i] = dddToByte(bs[i+1:])