diff options
Diffstat (limited to 'miscutils/bc.c')
-rw-r--r-- | miscutils/bc.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/miscutils/bc.c b/miscutils/bc.c index fe555d018..01402b311 100644 --- a/miscutils/bc.c +++ b/miscutils/bc.c | |||
@@ -2892,6 +2892,8 @@ static char peek_inbuf(void) | |||
2892 | ) { | 2892 | ) { |
2893 | xc_read_line(&G.input_buffer, G.prs.lex_input_fp); | 2893 | xc_read_line(&G.input_buffer, G.prs.lex_input_fp); |
2894 | G.prs.lex_inbuf = G.input_buffer.v; | 2894 | G.prs.lex_inbuf = G.input_buffer.v; |
2895 | // lex_next_at may point to now-freed data, update it: | ||
2896 | G.prs.lex_next_at = G.prs.lex_inbuf; | ||
2895 | if (G.input_buffer.len <= 1) // on EOF, len is 1 (NUL byte) | 2897 | if (G.input_buffer.len <= 1) // on EOF, len is 1 (NUL byte) |
2896 | G.prs.lex_input_fp = NULL; | 2898 | G.prs.lex_input_fp = NULL; |
2897 | } | 2899 | } |
@@ -3103,7 +3105,7 @@ static BC_STATUS zbc_lex_identifier(void) | |||
3103 | continue; | 3105 | continue; |
3104 | match: | 3106 | match: |
3105 | // buf starts with keyword bc_lex_kws[i] | 3107 | // buf starts with keyword bc_lex_kws[i] |
3106 | if (isalnum(buf[j]) || buf[j]=='_') | 3108 | if (isalnum(buf[j]) || buf[j] == '_') |
3107 | continue; // "ifz" does not match "if" keyword, "if." does | 3109 | continue; // "ifz" does not match "if" keyword, "if." does |
3108 | p->lex = BC_LEX_KEY_1st_keyword + i; | 3110 | p->lex = BC_LEX_KEY_1st_keyword + i; |
3109 | if (!keyword_is_POSIX(i)) { | 3111 | if (!keyword_is_POSIX(i)) { |