summaryrefslogtreecommitdiffhomepage
path: root/rfc1035label/label.go
diff options
context:
space:
mode:
authorErik Geiser <erik.geiser@redteam-pentesting.de>2022-05-23 14:38:45 +0200
committerErik Geiser <erik.geiser@redteam-pentesting.de>2022-05-23 14:38:45 +0200
commita91ce0db92a593b386863adceaf420b01f5de1a3 (patch)
treee6cde5056223edae2add6c25daf70cc67194a6ba /rfc1035label/label.go
parentb437b69f18fd2a2e59bd3ff51685896ee53d0709 (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.go8
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])