summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDenis Vlasenko2008-10-18 19:18:51 +0000
committerDenis Vlasenko2008-10-18 19:18:51 +0000
commit3ab3d8a5cfb1cfd6d2fceeea93066c4e63e5f22d (patch)
tree6c4b25af46cf78e0a92d56a3987f7bc1c2ba10d0
parentf9dde919d6ff592777c6b268d9c96d4214a9e711 (diff)
downloadbusybox-3ab3d8a5cfb1cfd6d2fceeea93066c4e63e5f22d.zip
busybox-3ab3d8a5cfb1cfd6d2fceeea93066c4e63e5f22d.tar.gz
libbb: do not reject floating point strings like ".15"
-rw-r--r--libbb/bb_strtod.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/libbb/bb_strtod.c b/libbb/bb_strtod.c
index 0515ff8..39bdeb5 100644
--- a/libbb/bb_strtod.c
+++ b/libbb/bb_strtod.c
@@ -17,7 +17,8 @@ double FAST_FUNC bb_strtod(const char *arg, char **endp)
double v;
char *endptr;
- if (arg[0] != '-' && NOT_DIGIT(arg[0]))
+ /* Allow .NN form. People want to use "sleep .15" etc */
+ if (arg[0] != '-' && arg[0] != '.' && NOT_DIGIT(arg[0]))
goto err;
errno = 0;
v = strtod(arg, &endptr);