diff --git a/library/ssl_msg.c b/library/ssl_msg.c index 1162cca022..5deaedaccf 100644 --- a/library/ssl_msg.c +++ b/library/ssl_msg.c @@ -5593,7 +5593,7 @@ int mbedtls_ssl_read(mbedtls_ssl_context *ssl, unsigned char *buf, size_t len) n = (len < ssl->in_msglen) ? len : ssl->in_msglen; - if (buf) { + if (len != 0) { memcpy(buf, ssl->in_offt, n); ssl->in_msglen -= n; }