diff options
author | tb <> | 2021-11-02 13:59:29 +0000 |
---|---|---|
committer | tb <> | 2021-11-02 13:59:29 +0000 |
commit | 861cb5567903704da143ec766cc7858c5a7e0188 (patch) | |
tree | 6b9433900bd8124790d66304670eeb27f8bb766a /src/lib | |
parent | b1d784eb6c4f1df06e96cfc40e2434cf76165cbe (diff) | |
download | openbsd-861cb5567903704da143ec766cc7858c5a7e0188.tar.gz openbsd-861cb5567903704da143ec766cc7858c5a7e0188.tar.bz2 openbsd-861cb5567903704da143ec766cc7858c5a7e0188.zip |
Do not take the strlen() of a NULL name. Defer the CBS_init() to later.
Found the hard way by sthen.
ok sthen
Diffstat (limited to 'src/lib')
-rw-r--r-- | src/lib/libssl/s3_lib.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/lib/libssl/s3_lib.c b/src/lib/libssl/s3_lib.c index c4d68f654e..497dea6f08 100644 --- a/src/lib/libssl/s3_lib.c +++ b/src/lib/libssl/s3_lib.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: s3_lib.c,v 1.218 2021/11/01 16:45:56 jsing Exp $ */ | 1 | /* $OpenBSD: s3_lib.c,v 1.219 2021/11/02 13:59:29 tb Exp $ */ |
2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) |
3 | * All rights reserved. | 3 | * All rights reserved. |
4 | * | 4 | * |
@@ -1789,14 +1789,14 @@ _SSL_set_tlsext_host_name(SSL *s, const char *name) | |||
1789 | int is_ip; | 1789 | int is_ip; |
1790 | CBS cbs; | 1790 | CBS cbs; |
1791 | 1791 | ||
1792 | CBS_init(&cbs, name, strlen(name)); | ||
1793 | |||
1794 | free(s->tlsext_hostname); | 1792 | free(s->tlsext_hostname); |
1795 | s->tlsext_hostname = NULL; | 1793 | s->tlsext_hostname = NULL; |
1796 | 1794 | ||
1797 | if (name == NULL) | 1795 | if (name == NULL) |
1798 | return 1; | 1796 | return 1; |
1799 | 1797 | ||
1798 | CBS_init(&cbs, name, strlen(name)); | ||
1799 | |||
1800 | if (!tlsext_sni_is_valid_hostname(&cbs, &is_ip)) { | 1800 | if (!tlsext_sni_is_valid_hostname(&cbs, &is_ip)) { |
1801 | SSLerror(s, SSL_R_SSL3_EXT_INVALID_SERVERNAME); | 1801 | SSLerror(s, SSL_R_SSL3_EXT_INVALID_SERVERNAME); |
1802 | return 0; | 1802 | return 0; |