From f518f81d41bb44ae548f0321a260e1e761f47bea Mon Sep 17 00:00:00 2001 From: Paul Elliott Date: Mon, 11 Jul 2022 12:36:20 +0100 Subject: [PATCH] Ensure return for mbedtls_ssl_write_alpn_ext() is checked Signed-off-by: Paul Elliott --- library/ssl_tls12_server.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/library/ssl_tls12_server.c b/library/ssl_tls12_server.c index bfe3e8e0b..4e18e6285 100644 --- a/library/ssl_tls12_server.c +++ b/library/ssl_tls12_server.c @@ -2387,7 +2387,10 @@ static int ssl_write_server_hello( mbedtls_ssl_context *ssl ) #if defined(MBEDTLS_SSL_ALPN) unsigned char *end = buf + MBEDTLS_SSL_OUT_CONTENT_LEN - 4; - mbedtls_ssl_write_alpn_ext( ssl, p + 2 + ext_len, end, &olen ); + if( ( ret = mbedtls_ssl_write_alpn_ext( ssl, p + 2 + ext_len, end, &olen ) ) + != 0 ) + return ret; + ext_len += olen; #endif