summaryrefslogtreecommitdiff
path: root/util.c
diff options
context:
space:
mode:
Diffstat (limited to 'util.c')
-rw-r--r--util.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/util.c b/util.c
index 449d4bf439..6c18543347 100644
--- a/util.c
+++ b/util.c
@@ -783,9 +783,9 @@ ruby_strtod(string, endPtr)
* and also locate the decimal point.
*/
- for ( ; c = *p; p++) {
+ for ( ; (c = *p) != '\0'; p++) {
if (!ISDIGIT(c)) {
- if (c != '.' || hasPoint) {
+ if (c != '.' || hasPoint || !ISDIGIT(p[1])) {
break;
}
hasPoint = Qtrue;