From 98ebf488f5f51376e0bf9d95501d588f1d97edee Mon Sep 17 00:00:00 2001 From: Waleed Elmelegy Date: Fri, 15 Mar 2024 14:29:24 +0000 Subject: [PATCH] Fix bug in ALPN loading from serialized session Signed-off-by: Waleed Elmelegy --- ChangeLog.d/fix-alpn-negotiating-bug.txt | 3 +++ library/ssl_tls.c | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) create mode 100644 ChangeLog.d/fix-alpn-negotiating-bug.txt diff --git a/ChangeLog.d/fix-alpn-negotiating-bug.txt b/ChangeLog.d/fix-alpn-negotiating-bug.txt new file mode 100644 index 000000000..3bceb37f3 --- /dev/null +++ b/ChangeLog.d/fix-alpn-negotiating-bug.txt @@ -0,0 +1,3 @@ +Bugfix + * Fix the restoration of the ALPN when loading serialized connection with + * the mbedtls_ssl_context_load() API. diff --git a/library/ssl_tls.c b/library/ssl_tls.c index 235959a9e..c667a2923 100644 --- a/library/ssl_tls.c +++ b/library/ssl_tls.c @@ -6680,7 +6680,7 @@ static int ssl_context_load(mbedtls_ssl_context *ssl, /* alpn_chosen should point to an item in the configured list */ for (cur = ssl->conf->alpn_list; *cur != NULL; cur++) { if (strlen(*cur) == alpn_len && - memcmp(p, cur, alpn_len) == 0) { + memcmp(p, *cur, alpn_len) == 0) { ssl->alpn_chosen = *cur; break; }