From e957b50e500504d1c3970312a07373e8a5972f15 Mon Sep 17 00:00:00 2001 From: Aditya Patwardhan Date: Fri, 23 Aug 2024 12:08:42 +0530 Subject: [PATCH] fix(esp-tls): Reduce parameter check for esp_tls_conn_read Previously the *data parameters of esp_tls_conn_read was required to be non-NULL after espressif/esp-idf!28358. This prevents users from using a functionality in esp_tls_conn_read where calling `esp_tls_conn_read(ctx, NULL, 0);` triggers the transfer of contents from tcp layer to mbedtls (ssl) layer. After this the user can read the contents from esp_tls_get_bytes_avail(). This commit removes the additional NULL check on the data field to keep this functionality enabled. --- components/esp-tls/esp_tls.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/esp-tls/esp_tls.c b/components/esp-tls/esp_tls.c index a23eb27e8e..063a87a3a3 100644 --- a/components/esp-tls/esp_tls.c +++ b/components/esp-tls/esp_tls.c @@ -132,7 +132,7 @@ static ssize_t tcp_write(esp_tls_t *tls, const char *data, size_t datalen) ssize_t esp_tls_conn_read(esp_tls_t *tls, void *data, size_t datalen) { - if (!tls || !data) { + if (!tls) { return -1; } return tls->read(tls, (char *)data, datalen);