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 8bf5532ee6c2a523e21adf4d7cfd4151aa670ef3 Author: Marco Casaroli <[email protected]> AuthorDate: Thu Nov 5 06:51:56 2026 +0100 libs/libc/stream: Count a three-digit exponent in the width. A float conversion in the exponent form took the exponent as two digits for the padding. "%12.1e" of 1e100 wrote 13 bytes. A sprintf() into a buffer that has the size of the width overflows by one byte. Add one for an exponent with three digits. 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 | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/libs/libc/stream/lib_libvsprintf.c b/libs/libc/stream/lib_libvsprintf.c index 372544a8917..5ebb2c3b98b 100644 --- a/libs/libc/stream/lib_libvsprintf.c +++ b/libs/libc/stream/lib_libvsprintf.c @@ -820,6 +820,10 @@ flt_oper: else { flen = 5; /* 1e+00 */ + if (exp >= 100 || exp <= -100) + { + flen++; + } } if (sign != 0)
