[git commit] tls: use capped SNI len everywhere

Denys Vlasenko vda.linux at googlemail.com
Tue Jul 4 14:52:45 UTC 2017


commit: https://git.busybox.net/busybox/commit/?id=558aae1a3384fce626d98608730f3b2d919bb78f
branch: https://git.busybox.net/busybox/commit/?id=refs/heads/master

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