From d2900b1c29982ca3eaca81a8bd846e70fd8b720c Mon Sep 17 00:00:00 2001 From: Jerzy Kasenberg Date: Fri, 19 Apr 2024 13:11:07 +0200 Subject: [PATCH] libc/baselibc: Fix floating point argument access 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 --- libc/baselibc/src/tinyprintf.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libc/baselibc/src/tinyprintf.c b/libc/baselibc/src/tinyprintf.c index b7fff93bcd..efced43376 100644 --- a/libc/baselibc/src/tinyprintf.c +++ b/libc/baselibc/src/tinyprintf.c @@ -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 */