summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDenys Vlasenko2017-07-04 16:52:45 +0200
committerDenys Vlasenko2017-07-18 19:20:58 +0200
commit8965e5089efea4fdfc27241967098833f56de060 (patch)
tree0d2b19eac9b203981c95ac244d994acf84450fa5
parente916d48e5a3a033469d34f5646b8c12963975d99 (diff)
downloadbusybox-8965e5089efea4fdfc27241967098833f56de060.zip
busybox-8965e5089efea4fdfc27241967098833f56de060.tar.gz
tls: use capped SNI len everywhere
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
-rw-r--r--networking/tls.c4
1 files 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);