Skip to content

Commit c282cd8

Browse files
authored
Remove temp buffer in WiFiClientSecure::lastError (#4822)
The temp buffer serves no purpose here. Also mbedtls_strerror can be called with size == 0 safely.
1 parent 7e59971 commit c282cd8

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

Diff for: libraries/WiFiClientSecure/src/WiFiClientSecure.cpp

+1-3
Original file line numberDiff line numberDiff line change
@@ -333,9 +333,7 @@ int WiFiClientSecure::lastError(char *buf, const size_t size)
333333
if (!_lastError) {
334334
return 0;
335335
}
336-
char error_buf[100];
337-
mbedtls_strerror(_lastError, error_buf, 100);
338-
snprintf(buf, size, "%s", error_buf);
336+
mbedtls_strerror(_lastError, buf, size);
339337
return _lastError;
340338
}
341339

0 commit comments

Comments
 (0)