[git commit branch/1_27_stable] tls: use capped SNI len everywhere

Denys Vlasenko vda.linux at googlemail.com
Tue Jul 18 17:20:58 UTC 2017


commit: https://git.busybox.net/busybox/commit/?id=8965e5089efea4fdfc27241967098833f56de060
branch: https://git.busybox.net/busybox/commit/?id=refs/heads/1_27_stable

Signed-off-by: Denys Vlasenko <vda.linux at googlemail.com>
---
 networking/tls.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/networking/tls.c b/networking/tls.c
index db518bf..fd3cb0d 100644
--- a/networking/tls.c
+++ b/networking/tls.c
@@ -1199,11 +1199,11 @@ static void send_client_hello_and_alloc_hsd(tls_state_t *tls, const char *sni)
 	};
 	struct client_hello *record;
 	int len;
-	int sni_len = sni ? strnlen(sni, 127) : 0;
+	int sni_len = sni ? strnlen(sni, 127 - 9) : 0;
 
 	len = sizeof(*record);
 	if (sni_len)
-		len += 11 + strlen(sni);
+		len += 11 + sni_len;
 	record = tls_get_outbuf(tls, len);
 	memset(record, 0, len);
 


More information about the busybox-cvs mailing list