Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions cores/portduino/PortduinoPrint.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,10 @@ size_t Print::printf(const char *format, ...) {
// Linux that is fine, TBD on MyNewt
va_list args;
va_start(args, format);
size_t n = vsnprintf(buf, sizeof(buf), format, args);
write(buf);
int n = vsnprintf(buf, sizeof(buf), format, args);
va_end(args);
return n;
}
if (n <= 0) return 0;
// vsnprintf returns the would-be length; clamp to what actually fit.
size_t len = (n < (int)sizeof(buf)) ? (size_t)n : sizeof(buf) - 1;
return write((const uint8_t *)buf, len);
}