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.
This commit is contained in:
Aditya Patwardhan 2024-08-23 12:08:42 +05:30
parent 0d79e41ebc
commit e957b50e50
No known key found for this signature in database
GPG Key ID: E628B2648FBF0DD8

View File

@ -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) ssize_t esp_tls_conn_read(esp_tls_t *tls, void *data, size_t datalen)
{ {
if (!tls || !data) { if (!tls) {
return -1; return -1;
} }
return tls->read(tls, (char *)data, datalen); return tls->read(tls, (char *)data, datalen);