mirror of
https://github.com/mruby/mruby
synced 2026-06-08 16:11:16 +00:00
Avoid Heap Overflow in heredoc_remove_indent; fix #5316
This commit is contained in:
@@ -4693,7 +4693,8 @@ heredoc_remove_indent(parser_state *p, parser_heredoc_info *hinf)
|
||||
escaped = escaped->cdr;
|
||||
nspaces = nspaces->cdr;
|
||||
}
|
||||
newstr[newlen] = '\0';
|
||||
if (newlen < len)
|
||||
newstr[newlen] = '\0';
|
||||
pair->car = (node*)newstr;
|
||||
pair->cdr = (node*)newlen;
|
||||
} else {
|
||||
|
||||
@@ -10729,7 +10729,8 @@ heredoc_remove_indent(parser_state *p, parser_heredoc_info *hinf)
|
||||
escaped = escaped->cdr;
|
||||
nspaces = nspaces->cdr;
|
||||
}
|
||||
newstr[newlen] = '\0';
|
||||
if (newlen < len)
|
||||
newstr[newlen] = '\0';
|
||||
pair->car = (node*)newstr;
|
||||
pair->cdr = (node*)newlen;
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user