summaryrefslogtreecommitdiff
path: root/meta-openbmc-mods/meta-common/recipes-core/busybox/busybox/CVE-2022-30065.patch
diff options
context:
space:
mode:
Diffstat (limited to 'meta-openbmc-mods/meta-common/recipes-core/busybox/busybox/CVE-2022-30065.patch')
-rw-r--r--meta-openbmc-mods/meta-common/recipes-core/busybox/busybox/CVE-2022-30065.patch48
1 files changed, 48 insertions, 0 deletions
diff --git a/meta-openbmc-mods/meta-common/recipes-core/busybox/busybox/CVE-2022-30065.patch b/meta-openbmc-mods/meta-common/recipes-core/busybox/busybox/CVE-2022-30065.patch
new file mode 100644
index 000000000..2f23931be
--- /dev/null
+++ b/meta-openbmc-mods/meta-common/recipes-core/busybox/busybox/CVE-2022-30065.patch
@@ -0,0 +1,48 @@
+From 4bae4300986d0ed3d43f92600bd291ae3d302a99 Mon Sep 17 00:00:00 2001
+From: Yaswanth Reddy M <yaswanthx.reddy.munukuru@intel.com>
+Date: Fri, 5 May 2023 08:55:31 +0000
+Subject: [PATCH] Subject: awk: fix use after free (CVE-2022-30065)
+
+fixes https://bugs.busybox.net/show_bug.cgi?id=14781
+
+function old new delta
+evaluate 3343 3357 +14
+
+Signed-off-by: Yaswanth Reddy M <yaswanthx.reddy.munukuru@intel.com>
+---
+ editors/awk.c | 3 +++
+ testsuite/awk.tests | 5 +++++
+ 2 files changed, 8 insertions(+)
+
+diff --git a/editors/awk.c b/editors/awk.c
+index 3adbca7..43a17c0 100644
+--- a/editors/awk.c
++++ b/editors/awk.c
+@@ -3094,6 +3094,9 @@ static var *evaluate(node *op, var *res)
+
+ case XC( OC_MOVE ):
+ debug_printf_eval("MOVE\n");
++ /* make sure that we never return a temp var */
++ if (L.v == TMPVAR0)
++ L.v = res;
+ /* if source is a temporary string, jusk relink it to dest */
+ if (R.v == TMPVAR1
+ && !(R.v->type & VF_NUMBER)
+diff --git a/testsuite/awk.tests b/testsuite/awk.tests
+index dc2ae2e..072c8fc 100755
+--- a/testsuite/awk.tests
++++ b/testsuite/awk.tests
+@@ -462,5 +462,10 @@ testing "awk \"cmd\" | getline" \
+ "awk 'BEGIN { \"echo HELLO\" | getline; print }'" \
+ "HELLO\n" \
+ '' ''
++testing 'awk assign while test' \
++ "awk '\$1==\$1=\"foo\" {print \$1}'" \
++ "foo\n" \
++ "" \
++ "foo"
+
+ exit $FAILCOUNT
+--
+2.25.1
+