From e6e2017d3c4a5e95baa2378430c7a9aebedada1d Mon Sep 17 00:00:00 2001 From: lilei19 Date: Tue, 21 Feb 2023 19:40:24 +0800 Subject: [PATCH] fix a bug of strtof --- libs/libc/stdlib/lib_strtold.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/libs/libc/stdlib/lib_strtold.c b/libs/libc/stdlib/lib_strtold.c index 2bc5b9002f..a43212d3cb 100644 --- a/libs/libc/stdlib/lib_strtold.c +++ b/libs/libc/stdlib/lib_strtold.c @@ -335,7 +335,8 @@ static long_double decfloat(FAR char *ptr, FAR char **endptr) } } - if ((c | 32) == 'e') + if ((c | 32) == 'e' && (isdigit(*f) || ((*f == '+' || *f == '-') && + (isdigit(*(f + 1)))))) { num_decimal = scanexp(&f, 1) + num_decimal; if (num_decimal <= llong_min / 100)