diff options
author | inoguchi <> | 2020-09-09 12:31:23 +0000 |
---|---|---|
committer | inoguchi <> | 2020-09-09 12:31:23 +0000 |
commit | cb096711e5a5bfe60dece12c6bc854f5487ff5a4 (patch) | |
tree | ed1f22c0236ecbddf56cbe202dcbb07ba2185580 /src | |
parent | 3f2dd3140c402b9a03bfac6c0e2504be39410d1b (diff) | |
download | openbsd-cb096711e5a5bfe60dece12c6bc854f5487ff5a4.tar.gz openbsd-cb096711e5a5bfe60dece12c6bc854f5487ff5a4.tar.bz2 openbsd-cb096711e5a5bfe60dece12c6bc854f5487ff5a4.zip |
Set alpn_selected_len = 0 when alpn_selected is NULL
ok jsing@ tb@
Diffstat (limited to 'src')
-rw-r--r-- | src/lib/libssl/ssl_tlsext.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/lib/libssl/ssl_tlsext.c b/src/lib/libssl/ssl_tlsext.c index f3078f3efe..a039d0b10a 100644 --- a/src/lib/libssl/ssl_tlsext.c +++ b/src/lib/libssl/ssl_tlsext.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: ssl_tlsext.c,v 1.81 2020/08/03 19:46:55 tb Exp $ */ | 1 | /* $OpenBSD: ssl_tlsext.c,v 1.82 2020/09/09 12:31:23 inoguchi Exp $ */ |
2 | /* | 2 | /* |
3 | * Copyright (c) 2016, 2017, 2019 Joel Sing <jsing@openbsd.org> | 3 | * Copyright (c) 2016, 2017, 2019 Joel Sing <jsing@openbsd.org> |
4 | * Copyright (c) 2017 Doug Hogan <doug@openbsd.org> | 4 | * Copyright (c) 2017 Doug Hogan <doug@openbsd.org> |
@@ -91,6 +91,7 @@ tlsext_alpn_server_parse(SSL *s, uint16_t msg_types, CBS *cbs, int *alert) | |||
91 | if (r == SSL_TLSEXT_ERR_OK) { | 91 | if (r == SSL_TLSEXT_ERR_OK) { |
92 | free(S3I(s)->alpn_selected); | 92 | free(S3I(s)->alpn_selected); |
93 | if ((S3I(s)->alpn_selected = malloc(selected_len)) == NULL) { | 93 | if ((S3I(s)->alpn_selected = malloc(selected_len)) == NULL) { |
94 | S3I(s)->alpn_selected_len = 0; | ||
94 | *alert = SSL_AD_INTERNAL_ERROR; | 95 | *alert = SSL_AD_INTERNAL_ERROR; |
95 | return 0; | 96 | return 0; |
96 | } | 97 | } |
@@ -2193,6 +2194,7 @@ tlsext_server_reset_state(SSL *s) | |||
2193 | S3I(s)->renegotiate_seen = 0; | 2194 | S3I(s)->renegotiate_seen = 0; |
2194 | free(S3I(s)->alpn_selected); | 2195 | free(S3I(s)->alpn_selected); |
2195 | S3I(s)->alpn_selected = NULL; | 2196 | S3I(s)->alpn_selected = NULL; |
2197 | S3I(s)->alpn_selected_len = 0; | ||
2196 | s->internal->srtp_profile = NULL; | 2198 | s->internal->srtp_profile = NULL; |
2197 | } | 2199 | } |
2198 | 2200 | ||
@@ -2218,6 +2220,7 @@ tlsext_client_reset_state(SSL *s) | |||
2218 | S3I(s)->renegotiate_seen = 0; | 2220 | S3I(s)->renegotiate_seen = 0; |
2219 | free(S3I(s)->alpn_selected); | 2221 | free(S3I(s)->alpn_selected); |
2220 | S3I(s)->alpn_selected = NULL; | 2222 | S3I(s)->alpn_selected = NULL; |
2223 | S3I(s)->alpn_selected_len = 0; | ||
2221 | } | 2224 | } |
2222 | 2225 | ||
2223 | int | 2226 | int |