From eed3ec90478af1e1fd3a2733293c751d2181f7f7 Mon Sep 17 00:00:00 2001 From: Todd Short Date: Mon, 26 Jun 2017 09:21:20 -0400 Subject: [PATCH] ssl_session_dup() missing ext.alpn_session Properly copy ext.alpn_session in ssl_session_dup() Use OPENSSL_strndup() as that's used in ssl_asn1.c Reviewed-by: Matt Caswell Reviewed-by: Ben Kaduk (Merged from https://github.com/openssl/openssl/pull/3770) --- ssl/ssl_sess.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/ssl/ssl_sess.c b/ssl/ssl_sess.c index df992bd2f3..e7fe714e58 100644 --- a/ssl/ssl_sess.c +++ b/ssl/ssl_sess.c @@ -122,6 +122,7 @@ SSL_SESSION *ssl_session_dup(SSL_SESSION *src, int ticket) dest->ext.supportedgroups = NULL; #endif dest->ext.tick = NULL; + dest->ext.alpn_selected = NULL; #ifndef OPENSSL_NO_SRP dest->srp_username = NULL; #endif @@ -212,6 +213,15 @@ SSL_SESSION *ssl_session_dup(SSL_SESSION *src, int ticket) dest->ext.ticklen = 0; } + if (src->ext.alpn_selected) { + dest->ext.alpn_selected = + (unsigned char*)OPENSSL_strndup((char*)src->ext.alpn_selected, + src->ext.alpn_selected_len); + if (dest->ext.alpn_selected == NULL) { + goto err; + } + } + #ifndef OPENSSL_NO_SRP if (src->srp_username) { dest->srp_username = OPENSSL_strdup(src->srp_username); -- 2.25.1