From 5a234cf6428c88422d3230fa7eb22de1e842c86d Mon Sep 17 00:00:00 2001 From: jim Date: Wed, 15 Nov 2023 21:09:47 +0800 Subject: [PATCH] mbedtls: Fix enable dynamic mbedtls will occur heap corruption when server support TLS renegotiation --- components/mbedtls/port/dynamic/esp_ssl_cli.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/components/mbedtls/port/dynamic/esp_ssl_cli.c b/components/mbedtls/port/dynamic/esp_ssl_cli.c index 9fb224419c..0ea78df59d 100644 --- a/components/mbedtls/port/dynamic/esp_ssl_cli.c +++ b/components/mbedtls/port/dynamic/esp_ssl_cli.c @@ -185,6 +185,11 @@ static int manage_resource(mbedtls_ssl_context *ssl, bool add) case MBEDTLS_SSL_FLUSH_BUFFERS: break; case MBEDTLS_SSL_HANDSHAKE_WRAPUP: +#if defined(MBEDTLS_SSL_RENEGOTIATION) + if (add && ssl->MBEDTLS_PRIVATE(renego_status)) { + CHECK_OK(esp_mbedtls_add_rx_buffer(ssl)); + } +#endif break; default: break;