mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
[ruby/cgi] Fix integer overflow
Make use of the check in rb_alloc_tmp_buffer2. https://hackerone.com/reports/1328463 https://github.com/ruby/cgi/commit/c728632c1c
This commit is contained in:
parent
3454a456d1
commit
da34f31ad0
1 changed files with 2 additions and 1 deletions
|
@ -36,7 +36,8 @@ static VALUE
|
||||||
optimized_escape_html(VALUE str)
|
optimized_escape_html(VALUE str)
|
||||||
{
|
{
|
||||||
VALUE vbuf;
|
VALUE vbuf;
|
||||||
char *buf = ALLOCV_N(char, vbuf, RSTRING_LEN(str) * HTML_ESCAPE_MAX_LEN);
|
typedef char escape_buf[HTML_ESCAPE_MAX_LEN];
|
||||||
|
char *buf = *ALLOCV_N(escape_buf, vbuf, RSTRING_LEN(str));
|
||||||
const char *cstr = RSTRING_PTR(str);
|
const char *cstr = RSTRING_PTR(str);
|
||||||
const char *end = cstr + RSTRING_LEN(str);
|
const char *end = cstr + RSTRING_LEN(str);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue