summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorDenys Vlasenko <vda.linux@googlemail.com>2017-07-04 16:52:45 +0200
committerDenys Vlasenko <vda.linux@googlemail.com>2017-07-04 16:52:45 +0200
commit558aae1a3384fce626d98608730f3b2d919bb78f (patch)
tree3bd0b4b219847db780929442e6ad1bb62f04624a
parent034ceabe8221fb924277cd6b1e07303ecb93408f (diff)
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 db518bf90..fd3cb0dba 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);