mirror of
https://github.com/esphome/esphome.git
synced 2026-09-17 18:18:43 +00:00
Add diagnostic message before abort on buffer overflow
This commit is contained in:
@@ -32,6 +32,9 @@ static int write_printf_buffer(FILE *stream, char *buf, int len) {
|
||||
size_t write_len = len;
|
||||
if (write_len >= PRINTF_BUFFER_SIZE) {
|
||||
fwrite(buf, 1, PRINTF_BUFFER_SIZE - 1, stream);
|
||||
// Use fwrite for the message to avoid recursive __wrap_printf call
|
||||
static const char msg[] = "\nprintf buffer overflow\n";
|
||||
fwrite(msg, 1, sizeof(msg) - 1, stream);
|
||||
abort();
|
||||
}
|
||||
if (fwrite(buf, 1, write_len, stream) < write_len || ferror(stream)) {
|
||||
|
||||
Reference in New Issue
Block a user