!59 fix CVE-2022-28391
From: @jackey_1024 Reviewed-by: @flyflyflypeng, @duguhaotian Signed-off-by: @duguhaotian
This commit is contained in:
commit
3d375d8453
82
backport-CVE-2022-28391.patch
Normal file
82
backport-CVE-2022-28391.patch
Normal file
@ -0,0 +1,82 @@
|
||||
From a847d643594b5512e958daeb2fa26ec3199118b0 Mon Sep 17 00:00:00 2001
|
||||
From: jikui <jikui2@huawei.com>
|
||||
Date: Tue, 19 Apr 2022 14:36:11 +0800
|
||||
Subject: [PATCH] busybox: fix CVE-2022-28391
|
||||
|
||||
backport from upstream:
|
||||
https://git.alpinelinux.org/aports/plain/main/busybox/0001-libbb-sockaddr2str-ensure-only-printable-characters-.patch
|
||||
https://git.alpinelinux.org/aports/plain/main/busybox/0002-nslookup-sanitize-all-printed-strings-with-printable.patch
|
||||
|
||||
Signed-off-by: jikui <jikui2@huawei.com>
|
||||
---
|
||||
libbb/xconnect.c | 5 +++--
|
||||
networking/nslookup.c | 8 ++++----
|
||||
2 files changed, 7 insertions(+), 6 deletions(-)
|
||||
|
||||
diff --git a/libbb/xconnect.c b/libbb/xconnect.c
|
||||
index eb2871c..b5520bb 100644
|
||||
--- a/libbb/xconnect.c
|
||||
+++ b/libbb/xconnect.c
|
||||
@@ -501,8 +501,9 @@ static char* FAST_FUNC sockaddr2str(const struct sockaddr *sa, int flags)
|
||||
);
|
||||
if (rc)
|
||||
return NULL;
|
||||
+ /* ensure host contains only printable characters */
|
||||
if (flags & IGNORE_PORT)
|
||||
- return xstrdup(host);
|
||||
+ return xstrdup(printable_string(host));
|
||||
#if ENABLE_FEATURE_IPV6
|
||||
if (sa->sa_family == AF_INET6) {
|
||||
if (strchr(host, ':')) /* heh, it's not a resolved hostname */
|
||||
@@ -513,7 +514,7 @@ static char* FAST_FUNC sockaddr2str(const struct sockaddr *sa, int flags)
|
||||
#endif
|
||||
/* For now we don't support anything else, so it has to be INET */
|
||||
/*if (sa->sa_family == AF_INET)*/
|
||||
- return xasprintf("%s:%s", host, serv);
|
||||
+ return xasprintf("%s:%s", printable_string(host), serv);
|
||||
/*return xstrdup(host);*/
|
||||
}
|
||||
|
||||
diff --git a/networking/nslookup.c b/networking/nslookup.c
|
||||
index 24e09d4..89b9c8a 100644
|
||||
--- a/networking/nslookup.c
|
||||
+++ b/networking/nslookup.c
|
||||
@@ -404,7 +404,7 @@ static int parse_reply(const unsigned char *msg, size_t len)
|
||||
//printf("Unable to uncompress domain: %s\n", strerror(errno));
|
||||
return -1;
|
||||
}
|
||||
- printf(format, ns_rr_name(rr), dname);
|
||||
+ printf(format, ns_rr_name(rr), printable_string(dname));
|
||||
break;
|
||||
|
||||
case ns_t_mx:
|
||||
@@ -419,7 +419,7 @@ static int parse_reply(const unsigned char *msg, size_t len)
|
||||
//printf("Cannot uncompress MX domain: %s\n", strerror(errno));
|
||||
return -1;
|
||||
}
|
||||
- printf("%s\tmail exchanger = %d %s\n", ns_rr_name(rr), n, dname);
|
||||
+ printf("%s\tmail exchanger = %d %s\n", ns_rr_name(rr), n, printable_string(dname));
|
||||
break;
|
||||
|
||||
case ns_t_txt:
|
||||
@@ -431,7 +431,7 @@ static int parse_reply(const unsigned char *msg, size_t len)
|
||||
if (n > 0) {
|
||||
memset(dname, 0, sizeof(dname));
|
||||
memcpy(dname, ns_rr_rdata(rr) + 1, n);
|
||||
- printf("%s\ttext = \"%s\"\n", ns_rr_name(rr), dname);
|
||||
+ printf("%s\ttext = \"%s\"\n", ns_rr_name(rr), printable_string(dname));
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -461,7 +461,7 @@ static int parse_reply(const unsigned char *msg, size_t len)
|
||||
return -1;
|
||||
}
|
||||
|
||||
- printf("\tmail addr = %s\n", dname);
|
||||
+ printf("\tmail addr = %s\n", printable_string(dname));
|
||||
cp += n;
|
||||
|
||||
printf("\tserial = %lu\n", ns_get32(cp));
|
||||
--
|
||||
2.17.1
|
||||
|
||||
@ -4,7 +4,7 @@
|
||||
%endif
|
||||
|
||||
%if "%{!?RELEASE:1}"
|
||||
%define RELEASE 11
|
||||
%define RELEASE 12
|
||||
%endif
|
||||
|
||||
Name: busybox
|
||||
@ -25,6 +25,7 @@ Patch6002: backport-CVE-2021-42374.patch
|
||||
Patch6003: backport-CVE-2021-42377.patch
|
||||
Patch6004: backport-CVE-2021-42376.patch
|
||||
Patch6005: backport-fix-awk-cve.patch
|
||||
Patch6006: backport-CVE-2022-28391.patch
|
||||
|
||||
BuildRoot: %_topdir/BUILDROOT
|
||||
#Dependency
|
||||
@ -100,6 +101,12 @@ install -m 644 docs/busybox.dynamic.1 $RPM_BUILD_ROOT/%{_mandir}/man1/busybox.1
|
||||
%{_mandir}/man1/busybox.petitboot.1.gz
|
||||
|
||||
%changelog
|
||||
* Tue Apr 19 2022 jikui <jikui2@huawei.com> - 1:1.31.1-12
|
||||
- Type:CVE
|
||||
- Id:NA
|
||||
- SUG:NA
|
||||
- DESC: fix CVE-2022-28391
|
||||
|
||||
* Tue Mar 22 2022 herengui <herengui@uniontech.com> - 1:1.31.1-11
|
||||
- Type:BUG
|
||||
- Id:NA
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user