This is an automated email from the ASF dual-hosted git repository.

jerzy pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/mynewt-core.git


The following commit(s) were added to refs/heads/master by this push:
     new d2900b1c2 libc/baselibc: Fix floating point argument access
d2900b1c2 is described below

commit d2900b1c29982ca3eaca81a8bd846e70fd8b720c
Author: Jerzy Kasenberg <[email protected]>
AuthorDate: Fri Apr 19 13:11:07 2024 +0200

    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 <[email protected]>
---
 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 b7fff93bc..efced4337 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 */

Reply via email to