mirror of
https://github.com/mruby/mruby
synced 2026-06-08 16:11:16 +00:00
parse.y: string buffer (tokbuf) can overflow.
Check if `esclen` is smaller than `len` (original string length).
This commit is contained in:
@@ -4682,6 +4682,7 @@ heredoc_remove_indent(parser_state *p, parser_heredoc_info *hinf)
|
||||
start = 0;
|
||||
while (start < len) {
|
||||
end = escaped ? (size_t)escaped->car : len;
|
||||
if (end > len) end = len;
|
||||
spaces = (size_t)nspaces->car;
|
||||
size_t esclen = end - start;
|
||||
heredoc_count_indent(hinf, str + start, esclen, spaces, &offset);
|
||||
|
||||
@@ -10718,6 +10718,7 @@ heredoc_remove_indent(parser_state *p, parser_heredoc_info *hinf)
|
||||
start = 0;
|
||||
while (start < len) {
|
||||
end = escaped ? (size_t)escaped->car : len;
|
||||
if (end > len) end = len;
|
||||
spaces = (size_t)nspaces->car;
|
||||
size_t esclen = end - start;
|
||||
heredoc_count_indent(hinf, str + start, esclen, spaces, &offset);
|
||||
|
||||
Reference in New Issue
Block a user