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 | d1496e8b8cfd3554a4ce72c33d42e4cb33667e96 (patch) | |
tree | 92b19a5663b9344a6b68af1d2559b011fd90ac61 /ext/date | |
parent | c2c81723a46a5207a59e2487a4466fbae3ba21f4 (diff) | |
download | ruby-d1496e8b8cfd3554a4ce72c33d42e4cb33667e96.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
Diffstat (limited to 'ext/date')
-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; } } |