This is an automated email from the ASF dual-hosted git repository. xiaoxiang781216 pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/nuttx.git
commit 40e67111df4ae5f927a5e6da404c15304ebb7ba1 Author: Marco Casaroli <[email protected]> AuthorDate: Thu Nov 5 06:51:54 2026 +0100 libs/libc/stream: Take the double of %f without floating point. With CONFIG_LIBC_NUMBERED_ARGS on and CONFIG_LIBC_FLOATINGPOINT off, "%f %s" did not take the double. The %s after it then used a wrong argument as a pointer. The code took the double only when numbered arguments were off, but a conversion without a number has its argument in the va_list in both cases. Take the double unless the conversion has an argument number. Part of https://github.com/apache/nuttx/issues/21467 Assisted-by: Claude Code:claude-opus-5-5 Signed-off-by: Marco Casaroli <[email protected]> --- libs/libc/stream/lib_libvsprintf.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/libs/libc/stream/lib_libvsprintf.c b/libs/libc/stream/lib_libvsprintf.c index 5cde9dd6150..1bb3d1ebe63 100644 --- a/libs/libc/stream/lib_libvsprintf.c +++ b/libs/libc/stream/lib_libvsprintf.c @@ -984,9 +984,13 @@ flt_oper: #else /* !CONFIG_LIBC_FLOATINGPOINT */ if ((c >= 'E' && c <= 'G') || (c >= 'e' && c <= 'g')) { -# ifndef CONFIG_LIBC_NUMBERED_ARGS - va_arg(ap, double); +# ifdef CONFIG_LIBC_NUMBERED_ARGS + if ((flags & FL_ARGNUMBER) == 0) # endif + { + va_arg(ap, double); + } + pnt = "*float*"; size = sizeof("*float*") - 1; goto str_lpad;
