From 1c43e7a7327f628d3b41ab044b6d6902dd4abca6 Mon Sep 17 00:00:00 2001 From: AJ ONeal Date: Mon, 16 Nov 2020 23:23:07 -0700 Subject: [PATCH] bugfix sni --- internal/sni/sni.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/internal/sni/sni.go b/internal/sni/sni.go index 6fc7088..e70d940 100644 --- a/internal/sni/sni.go +++ b/internal/sni/sni.go @@ -69,7 +69,6 @@ func GetHostname(b []byte) (hostname string, err error) { current += 2 if extensionType == 0 { - // Skip over number of names as we're assuming there's just one current += 2 @@ -81,6 +80,9 @@ func GetHostname(b []byte) (hostname string, err error) { nameLen := (int(rest[current]) << 8) + int(rest[current+1]) current += 2 hostname = string(rest[current : current+nameLen]) + if len(hostname) > 0 { + break + } } current += extensionDataLength