aboutsummaryrefslogtreecommitdiffstats
path: root/bignum.c
diff options
context:
space:
mode:
Diffstat (limited to 'bignum.c')
-rw-r--r--bignum.c9
1 files changed, 2 insertions, 7 deletions
diff --git a/bignum.c b/bignum.c
index 2bd44c2bf9..f06444d8dd 100644
--- a/bignum.c
+++ b/bignum.c
@@ -313,12 +313,7 @@ rb_cstr_to_inum(const char *str, int base, int badcheck)
if (badcheck) goto bad;
return INT2FIX(0);
}
- if (badcheck) {
- while (ISSPACE(*str)) str++;
- }
- else {
- while (ISSPACE(*str) || *str == '_') str++;
- }
+ while (ISSPACE(*str)) str++;
if (str[0] == '+') {
str++;
@@ -408,7 +403,7 @@ rb_cstr_to_inum(const char *str, int base, int badcheck)
if (len <= (sizeof(VALUE)*CHAR_BIT)) {
unsigned long val = strtoul(str, &end, base);
- if (*end == '_') goto bigparse;
+ if (str < end && *end == '_') goto bigparse;
if (badcheck) {
if (end == str) goto bad; /* no number */
while (*end && ISSPACE(*end)) end++;