HEREDOC could fail with NUL terminated lines; fix#3244

parent e86ead43
...@@ -3907,6 +3907,8 @@ parse_string(parser_state *p) ...@@ -3907,6 +3907,8 @@ parse_string(parser_state *p)
int end = (intptr_t)p->lex_strterm->cdr->cdr->cdr; int end = (intptr_t)p->lex_strterm->cdr->cdr->cdr;
parser_heredoc_info *hinf = (type & STR_FUNC_HEREDOC) ? parsing_heredoc_inf(p) : NULL; parser_heredoc_info *hinf = (type & STR_FUNC_HEREDOC) ? parsing_heredoc_inf(p) : NULL;
if (beg == 0) beg = -3; /* should never happen */
if (end == 0) end = -3;
newtok(p); newtok(p);
while ((c = nextc(p)) != end || nest_level != 0) { while ((c = nextc(p)) != end || nest_level != 0) {
if (hinf && (c == '\n' || c < 0)) { if (hinf && (c == '\n' || c < 0)) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment