diff options
author | Erik Geiser <erik.geiser@redteam-pentesting.de> | 2022-05-23 14:38:45 +0200 |
---|---|---|
committer | Erik Geiser <erik.geiser@redteam-pentesting.de> | 2022-05-23 14:38:45 +0200 |
commit | a91ce0db92a593b386863adceaf420b01f5de1a3 (patch) | |
tree | e6cde5056223edae2add6c25daf70cc67194a6ba /rfc1035label/label.go | |
parent | b437b69f18fd2a2e59bd3ff51685896ee53d0709 (diff) |
Decode partial domain name labels
Signed-off-by: Erik Geiser <erik.geiser@redteam-pentesting.de>
Diffstat (limited to 'rfc1035label/label.go')
-rw-r--r-- | rfc1035label/label.go | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/rfc1035label/label.go b/rfc1035label/label.go index 5a67d7c..561008e 100644 --- a/rfc1035label/label.go +++ b/rfc1035label/label.go @@ -100,6 +100,14 @@ func labelsFromBytes(buf []byte) ([]string, error) { for { if pos >= len(buf) { + // interpret label without trailing zero-length byte as a partial + // domain name field as per RFC 4704 Section 4.2 + if label != "" { + labels = append(labels, label) + + return labels, nil + } + break } length := int(buf[pos]) |