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 4d139c02d2c97b635ec6078d6aac6935aff77546 Author: chao an <[email protected]> AuthorDate: Mon Nov 2 11:31:16 2026 +0800 libc/stdio: Use strlen for unbounded strings Plain %s formats do not need the bounded scan used for precision handling. Use strlen() when no precision is specified so the common string path can use the simpler libc helper. Signed-off-by: chao an <[email protected]> --- libs/libc/stream/lib_libvsprintf.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/libs/libc/stream/lib_libvsprintf.c b/libs/libc/stream/lib_libvsprintf.c index c64d30c6365..4a8ee5c5f9a 100644 --- a/libs/libc/stream/lib_libvsprintf.c +++ b/libs/libc/stream/lib_libvsprintf.c @@ -1063,7 +1063,14 @@ flt_oper: } #endif - size = strnlen(pnt, (flags & FL_PREC) ? prec : ~0); + if ((flags & FL_PREC) != 0) + { + size = strnlen(pnt, prec); + } + else + { + size = strlen(pnt); + } str_lpad: if ((flags & FL_LPAD) == 0)
