smtp_client: Fixed garbage characters being printed

- The R/W buffers were not cleared before reading/writing
  anything new
This commit is contained in:
Laukik Hase 2022-04-14 13:35:02 +05:30
parent fd80ad82c2
commit b8263bb5ba
No known key found for this signature in database
GPG Key ID: 11C571361F51A199

View File

@ -100,6 +100,7 @@ static int write_and_get_response(mbedtls_net_context *sock_fd, unsigned char *b
do {
len = DATA_SIZE - 1;
memset(data, 0, DATA_SIZE);
ret = mbedtls_net_recv(sock_fd, data, len);
if (ret <= 0) {
@ -153,6 +154,7 @@ static int write_ssl_and_get_response(mbedtls_ssl_context *ssl, unsigned char *b
do {
len = DATA_SIZE - 1;
memset(data, 0, DATA_SIZE);
ret = mbedtls_ssl_read(ssl, data, len);
if (ret == MBEDTLS_ERR_SSL_WANT_READ || ret == MBEDTLS_ERR_SSL_WANT_WRITE) {