Skip to content

Commit

Permalink
Fix parser tmp-buffer overflow issue
Browse files Browse the repository at this point in the history
  • Loading branch information
trgil committed Dec 22, 2019
1 parent 9aa8b0b commit 8039693
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/src_parser.c
Expand Up @@ -171,7 +171,7 @@ static int src_parser_trans_stage_1_2_3(const int tmp_fd, const char *src, const
(PBUF_TMP_PREV_CHAR(pbuf) == ' ' || PBUF_TMP_PREV_CHAR(pbuf) == '\t' ||
PBUF_TMP_PREV_CHAR(pbuf) == '\n')) {
pbuf.f_indx++;
} else if (pbuf.tmp_indx &&
} else if (pbuf.tmp_indx &&
(PBUF_TMP_PREV_CHAR(pbuf) == '\\')) {
pbuf.tmp_indx--;
pbuf.f_indx++;
Expand All @@ -182,10 +182,12 @@ static int src_parser_trans_stage_1_2_3(const int tmp_fd, const char *src, const
continue;

case '\\':
p_buf_write_tmp(&pbuf, tmp_fd);
p_buf_push_tmp_char(&pbuf, '\\');
continue;

case '/':
p_buf_write_tmp(&pbuf, tmp_fd);
p_buf_push_tmp_char(&pbuf, '/');
continue;

Expand Down

0 comments on commit 8039693

Please sign in to comment.