Skip to content

Commit

Permalink
Merge pull request #40 from meshtastic/fix-printf
Browse files Browse the repository at this point in the history
fix crash in printf
  • Loading branch information
thebentern authored Dec 10, 2024
2 parents 23c32e1 + 3bc17a4 commit c1a196f
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions cores/portduino/PortduinoPrint.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,12 @@
#define MAX_STR_LEN 256

size_t Print::printf(const char *format, ...) {
char buf[MAX_STR_LEN]; // FIXME, this burns a lot of stack, but on
char buf[MAX_STR_LEN]; // FIXME, this burns a lot of stack, but on
// Linux that is fine, TBD on MyNewt
va_list args;
va_start(args, format);
vsnprintf(buf, sizeof(buf), format, args);
write(buf);
va_end(args);
va_list args;
va_start(args, format);
size_t n = vsnprintf(buf, sizeof(buf), format, args);
write(buf);
va_end(args);
return n;
}

0 comments on commit c1a196f

Please sign in to comment.