[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
@ -36,7 +36,8 @@ static VALUE
|
||||
optimized_escape_html(VALUE str)
|
||||
{
|
||||
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 *end = cstr + RSTRING_LEN(str);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user