Skip to content

Commit c1a196f

Browse files
authored
Merge pull request #40 from meshtastic/fix-printf
fix crash in printf
2 parents 23c32e1 + 3bc17a4 commit c1a196f

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

cores/portduino/PortduinoPrint.cpp

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,12 @@
66
#define MAX_STR_LEN 256
77

88
size_t Print::printf(const char *format, ...) {
9-
char buf[MAX_STR_LEN]; // FIXME, this burns a lot of stack, but on
9+
char buf[MAX_STR_LEN]; // FIXME, this burns a lot of stack, but on
1010
// Linux that is fine, TBD on MyNewt
11-
va_list args;
12-
va_start(args, format);
13-
vsnprintf(buf, sizeof(buf), format, args);
14-
write(buf);
15-
va_end(args);
11+
va_list args;
12+
va_start(args, format);
13+
size_t n = vsnprintf(buf, sizeof(buf), format, args);
14+
write(buf);
15+
va_end(args);
16+
return n;
1617
}

0 commit comments

Comments
 (0)