Remove temp buffer in WiFiClientSecure::lastError (#4822)

The temp buffer serves no purpose here. Also mbedtls_strerror can be called with size == 0 safely.
This commit is contained in:
Clemens Kirchgatterer 2021-02-18 10:44:44 +01:00 committed by GitHub
parent 7e59971d2f
commit c282cd8f5f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -333,9 +333,7 @@ int WiFiClientSecure::lastError(char *buf, const size_t size)
if (!_lastError) {
return 0;
}
char error_buf[100];
mbedtls_strerror(_lastError, error_buf, 100);
snprintf(buf, size, "%s", error_buf);
mbedtls_strerror(_lastError, buf, size);
return _lastError;
}