diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2015-06-16 09:45:50 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2015-06-16 09:45:50 +0000 |
commit | 6c2eb1cd76bb97d58e432bc852a47dcc114af517 (patch) | |
tree | 92b19a5663b9344a6b68af1d2559b011fd90ac61 | |
parent | 1f0ccacc771dbdad73aa1e00a035ac4e065a58fc (diff) | |
download | ruby-6c2eb1cd76bb97d58e432bc852a47dcc114af517.tar.gz |
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
-rw-r--r-- | ext/date/date_strptime.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/ext/date/date_strptime.c b/ext/date/date_strptime.c index e318af19f3..4f93219317 100644 --- a/ext/date/date_strptime.c +++ b/ext/date/date_strptime.c @@ -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; } } |