Skip to content

Commit c376872

Browse files
authored
Make PackDomainName return error if the root label doesn't fit (#1702)
* add PackDomainName tests for buffer size * make PackDomainName fail if root label doesn't fit * review: coding style * review: remove unit test
1 parent 604b539 commit c376872

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

msg.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -338,11 +338,13 @@ loop:
338338
return off + 2, nil
339339
}
340340

341+
// Trailing root label
341342
if off < len(msg) {
342343
msg[off] = 0
344+
return off + 1, nil
343345
}
344346

345-
return off + 1, nil
347+
return off, ErrBuf
346348
}
347349

348350
// isRootLabel returns whether s or bs, from off to end, is the root

0 commit comments

Comments
 (0)