Skip to content

Commit

Permalink
libc/baselibc: Fix floating point argument access
Browse files Browse the repository at this point in the history
When commint "Add va_list pointer compiling error workaround"
was introduced path for FLOAT_USER was not updated as all other
places that use va.

It result in va and va_to_pass used if formating string contains
%f and other like "%f %s %s"
This can result in wrong argument selection.

Signed-off-by: Jerzy Kasenberg <jerzy.kasenberg@codecoup.pl>
  • Loading branch information
kasjer committed Apr 19, 2024
1 parent bdfb665 commit d2900b1
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion libc/baselibc/src/tinyprintf.c
Original file line number Diff line number Diff line change
Expand Up @@ -380,7 +380,7 @@ size_t tfp_format(FILE *putp, const char *fmt, va_list va)
#if MYNEWT_VAL(FLOAT_USER)
case 'f':
p.base = 10;
d = va_arg(va, double);
d = va_arg(va_to_pass, double);
/* Convert to an int to get the integer part of the number. */
n = d;
/* Convert to ascii */
Expand Down

0 comments on commit d2900b1

Please sign in to comment.