/* SPDX-License-Identifier: LGPL-2.1+ */
+#include <ctype.h>
#include <errno.h>
#include <limits.h>
#include <stdlib.h>
if (*e == '.') {
char *b = e + 1;
- if (*b == '-') /* Don't allow 0.-0 */
+ /* Don't allow "0.-0", "3.+1" or "3. 1" */
+ if (*b == '-' || *b == '+' || isspace(*b))
return -EINVAL;
errno = 0;
if (*e == '.') {
char *b = e + 1;
- if (*b == '-')
+ if (*b == '-' || *b == '+' || isspace(*b))
return -EINVAL;
errno = 0;