1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

date_strptime.c: use ALLOCV

* ext/date/date_strptime.c (read_digits): use ALLOCV instead of
  ALLOCA get rid of stack overflow.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50918 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2015-06-16 09:45:50 +00:00
parent c2c81723a4
commit d1496e8b8c

View file

@ -103,10 +103,12 @@ read_digits(const char *s, VALUE *n, size_t width)
return l;
}
else {
char *s2 = ALLOCA_N(char, l + 1);
VALUE vbuf = 0;
char *s2 = ALLOCV_N(char, vbuf, l + 1);
memcpy(s2, s, l);
s2[l] = '\0';
*n = rb_cstr_to_inum(s2, 10, 0);
ALLOCV_END(vbuf);
return l;
}
}