diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/lib/libssl/s3_lib.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/src/lib/libssl/s3_lib.c b/src/lib/libssl/s3_lib.c index 71b86770ca..c4d68f654e 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.217 2021/10/25 10:01:46 jsing Exp $ */ | 1 | /* $OpenBSD: s3_lib.c,v 1.218 2021/11/01 16:45:56 jsing 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 | * |
@@ -162,6 +162,7 @@ | |||
162 | #include "dtls_locl.h" | 162 | #include "dtls_locl.h" |
163 | #include "ssl_locl.h" | 163 | #include "ssl_locl.h" |
164 | #include "ssl_sigalgs.h" | 164 | #include "ssl_sigalgs.h" |
165 | #include "ssl_tlsext.h" | ||
165 | 166 | ||
166 | #define SSL3_NUM_CIPHERS (sizeof(ssl3_ciphers) / sizeof(SSL_CIPHER)) | 167 | #define SSL3_NUM_CIPHERS (sizeof(ssl3_ciphers) / sizeof(SSL_CIPHER)) |
167 | 168 | ||
@@ -1785,17 +1786,21 @@ _SSL_set_ecdh_auto(SSL *s, int state) | |||
1785 | static int | 1786 | static int |
1786 | _SSL_set_tlsext_host_name(SSL *s, const char *name) | 1787 | _SSL_set_tlsext_host_name(SSL *s, const char *name) |
1787 | { | 1788 | { |
1789 | int is_ip; | ||
1790 | CBS cbs; | ||
1791 | |||
1792 | CBS_init(&cbs, name, strlen(name)); | ||
1793 | |||
1788 | free(s->tlsext_hostname); | 1794 | free(s->tlsext_hostname); |
1789 | s->tlsext_hostname = NULL; | 1795 | s->tlsext_hostname = NULL; |
1790 | 1796 | ||
1791 | if (name == NULL) | 1797 | if (name == NULL) |
1792 | return 1; | 1798 | return 1; |
1793 | 1799 | ||
1794 | if (strlen(name) > TLSEXT_MAXLEN_host_name) { | 1800 | if (!tlsext_sni_is_valid_hostname(&cbs, &is_ip)) { |
1795 | SSLerror(s, SSL_R_SSL3_EXT_INVALID_SERVERNAME); | 1801 | SSLerror(s, SSL_R_SSL3_EXT_INVALID_SERVERNAME); |
1796 | return 0; | 1802 | return 0; |
1797 | } | 1803 | } |
1798 | |||
1799 | if ((s->tlsext_hostname = strdup(name)) == NULL) { | 1804 | if ((s->tlsext_hostname = strdup(name)) == NULL) { |
1800 | SSLerror(s, ERR_R_INTERNAL_ERROR); | 1805 | SSLerror(s, ERR_R_INTERNAL_ERROR); |
1801 | return 0; | 1806 | return 0; |