From f68402565ab0d52e556c0bbfa89feec292133cb9 Mon Sep 17 00:00:00 2001 From: Dave Rodgman Date: Fri, 24 Feb 2023 15:41:34 +0000 Subject: [PATCH] Add corresponding fix for mbedtls_ssl_write Signed-off-by: Dave Rodgman --- library/ssl_msg.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/library/ssl_msg.c b/library/ssl_msg.c index 5deaedacc..4ed67b707 100644 --- a/library/ssl_msg.c +++ b/library/ssl_msg.c @@ -5672,7 +5672,9 @@ static int ssl_write_real(mbedtls_ssl_context *ssl, */ ssl->out_msglen = len; ssl->out_msgtype = MBEDTLS_SSL_MSG_APPLICATION_DATA; - memcpy(ssl->out_msg, buf, len); + if (len > 0) { + memcpy(ssl->out_msg, buf, len); + } if ((ret = mbedtls_ssl_write_record(ssl, SSL_FORCE_FLUSH)) != 0) { MBEDTLS_SSL_DEBUG_RET(1, "mbedtls_ssl_write_record", ret);