diff --git a/libs/libc/stdlib/lib_strtod.c b/libs/libc/stdlib/lib_strtod.c index 57f60787bb..358eb5aec2 100644 --- a/libs/libc/stdlib/lib_strtod.c +++ b/libs/libc/stdlib/lib_strtod.c @@ -160,6 +160,7 @@ double strtod(FAR const char *str, FAR char **endptr) { set_errno(ERANGE); number = 0.0; + p = (FAR char *)str; goto errout; } @@ -195,6 +196,14 @@ double strtod(FAR const char *str, FAR char **endptr) /* Process string of digits */ + if (!isdigit(*p)) + { + set_errno(ERANGE); + number = 0.0; + p = (FAR char *)str; + goto errout; + } + n = 0; while (isdigit(*p)) {