Andrew Geissler | 615f2f1 | 2022-07-15 14:00:58 -0500 | [diff] [blame^] | 1 | Fix use-after-free in awk. |
| 2 | |
| 3 | CVE: CVE-2022-30065 |
| 4 | Upstream-Status: Submitted [http://lists.busybox.net/pipermail/busybox/2022-June/089768.html] |
| 5 | Signed-off-by: Ross Burton <ross.burton@arm.com> |
| 6 | |
| 7 | fixes https://bugs.busybox.net/show_bug.cgi?id=14781 |
| 8 | |
| 9 | Signed-off-by: Natanael Copa <ncopa at alpinelinux.org> |
| 10 | --- |
| 11 | editors/awk.c | 3 +++ |
| 12 | 1 file changed, 3 insertions(+) |
| 13 | |
| 14 | diff --git a/editors/awk.c b/editors/awk.c |
| 15 | index 079d0bde5..728ee8685 100644 |
| 16 | --- a/editors/awk.c |
| 17 | +++ b/editors/awk.c |
| 18 | @@ -3128,6 +3128,9 @@ static var *evaluate(node *op, var *res) |
| 19 | |
| 20 | case XC( OC_MOVE ): |
| 21 | debug_printf_eval("MOVE\n"); |
| 22 | + /* make sure that we never return a temp var */ |
| 23 | + if (L.v == TMPVAR0) |
| 24 | + L.v = res; |
| 25 | /* if source is a temporary string, jusk relink it to dest */ |
| 26 | if (R.v == TMPVAR1 |
| 27 | && !(R.v->type & VF_NUMBER) |
| 28 | -- |
| 29 | 2.36.1 |