diff options
author | Denys Vlasenko <vda.linux@googlemail.com> | 2022-08-18 16:23:55 +0200 |
---|---|---|
committer | Denys Vlasenko <vda.linux@googlemail.com> | 2022-08-18 16:23:55 +0200 |
commit | 41d5f800a14769704082f7faeabb8435285499be (patch) | |
tree | 18f6ec45a450040aae10f3aa13a2f45c2662a79b | |
parent | 7c2a3bdde0a1316771fdd07ff03413f00383f70e (diff) | |
download | busybox-w32-41d5f800a14769704082f7faeabb8435285499be.tar.gz busybox-w32-41d5f800a14769704082f7faeabb8435285499be.tar.bz2 busybox-w32-41d5f800a14769704082f7faeabb8435285499be.zip |
bc: hopefully fix bug 14956 (use-after-free)
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
-rw-r--r-- | miscutils/bc.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/miscutils/bc.c b/miscutils/bc.c index ab785bbc8..1300a63fb 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 | } |