busybox: fix CVE-2022-30065

Signed-off-by: jackey_1024 <jikui2@huawei.com>
This commit is contained in:
jackey_1024 2022-08-19 16:58:09 +08:00
parent 938f90ce65
commit ecbff042ed
2 changed files with 54 additions and 1 deletions

View File

@ -0,0 +1,46 @@
From 111ae0c7f21dc600a2d2afcbecc69d73036a163f Mon Sep 17 00:00:00 2001
From: jackey_1024 <jikui2@huawei.com>
Date: Fri, 19 Aug 2022 16:15:59 +0800
Subject: [PATCH] busybox: fix CVE-2022-30065
backport from upstream:
https://git.busybox.net/busybox/commit/?id=e63d7cdfdac78c6fd27e9e63150335767592b85e
Signed-off-by: jackey_1024 <jikui2@huawei.com>
---
editors/awk.c | 3 +++
testsuite/awk.tests | 6 ++++++
2 files changed, 9 insertions(+)
diff --git a/editors/awk.c b/editors/awk.c
index f6314ac..6a5846e 100644
--- a/editors/awk.c
+++ b/editors/awk.c
@@ -3114,6 +3114,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 bcaafe8..156aa65 100755
--- a/testsuite/awk.tests
+++ b/testsuite/awk.tests
@@ -469,4 +469,10 @@ testing 'awk printf %% prints one %' \
"%\n" \
'' ''
+testing 'awk assign while test' \
+ "awk '\$1==\$1=\"foo\" {print \$1}'" \
+ "foo\n" \
+ "" \
+ "foo"
+
exit $FAILCOUNT
--
2.25.1

View File

@ -4,7 +4,7 @@
%endif %endif
%if "%{!?RELEASE:1}" %if "%{!?RELEASE:1}"
%define RELEASE 16 %define RELEASE 17
%endif %endif
Epoch: 1 Epoch: 1
@ -21,6 +21,7 @@ Source2: busybox-petitboot.config
Source3: busybox-dynamic.config Source3: busybox-dynamic.config
Patch6000: backport-CVE-2022-28391.patch Patch6000: backport-CVE-2022-28391.patch
Patch6001: backport-CVE-2022-30065.patch
BuildRoot: %_topdir/BUILDROOT BuildRoot: %_topdir/BUILDROOT
#Dependency #Dependency
@ -96,6 +97,12 @@ install -m 644 docs/busybox.dynamic.1 $RPM_BUILD_ROOT/%{_mandir}/man1/busybox.1
%{_mandir}/man1/busybox.petitboot.1.gz %{_mandir}/man1/busybox.petitboot.1.gz
%changelog %changelog
* Fri Aug 19 2022 jikui <jikui2@huawei.com> - 1:1.34.1-17
- Type:CVE
- Id:NA
- SUG:NA
- DESC:fix CVE-2022-30065
* Thu Jul 28 2022 jikui <jikui2@huawei.com> - 1:1.34.1-16 * Thu Jul 28 2022 jikui <jikui2@huawei.com> - 1:1.34.1-16
- Type:bugfix - Type:bugfix
- Id:NA - Id:NA