diff options
author | Richard Purdie <richard.purdie@linuxfoundation.org> | 2022-06-24 17:51:23 +0100 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2022-06-25 21:13:40 +0100 |
commit | a3545600bec67832044e854b2a068263a7eeddf7 (patch) | |
tree | da3ce832eea32e520a6c158745d5e75d9de228e2 | |
parent | bbdda8321d06358dff3386030d778c8d19b850ec (diff) | |
download | poky-a3545600bec67832044e854b2a068263a7eeddf7.tar.gz |
unzip: Port debian fixes for two CVEs
Add two fixes from debian for two CVEs. From:
https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1010355
I wans't able to get the reproducers to work but the added error
checking isn't probably a bad thing.
(From OE-Core rev: 054be00a632c2918dd1f973e76514e459fc6f017)
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r-- | meta/recipes-extended/unzip/unzip/CVE-2022-0529.patch | 39 | ||||
-rw-r--r-- | meta/recipes-extended/unzip/unzip/CVE-2022-0530.patch | 33 | ||||
-rw-r--r-- | meta/recipes-extended/unzip/unzip_6.0.bb | 2 |
3 files changed, 74 insertions, 0 deletions
diff --git a/meta/recipes-extended/unzip/unzip/CVE-2022-0529.patch b/meta/recipes-extended/unzip/unzip/CVE-2022-0529.patch new file mode 100644 index 0000000000..1c1e120deb --- /dev/null +++ b/meta/recipes-extended/unzip/unzip/CVE-2022-0529.patch | |||
@@ -0,0 +1,39 @@ | |||
1 | https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1010355 | ||
2 | |||
3 | CVE: CVE-2022-0529 | ||
4 | Upstream-Status: Inactive-Upstream [need a new release] | ||
5 | |||
6 | diff --git a/process.c b/process.c | ||
7 | index d2a846e..99b9c7b 100644 | ||
8 | --- a/process.c | ||
9 | +++ b/process.c | ||
10 | @@ -2507,13 +2507,15 @@ char *wide_to_local_string(wide_string, escape_all) | ||
11 | char buf[9]; | ||
12 | char *buffer = NULL; | ||
13 | char *local_string = NULL; | ||
14 | + size_t buffer_size; | ||
15 | |||
16 | for (wsize = 0; wide_string[wsize]; wsize++) ; | ||
17 | |||
18 | if (max_bytes < MAX_ESCAPE_BYTES) | ||
19 | max_bytes = MAX_ESCAPE_BYTES; | ||
20 | |||
21 | - if ((buffer = (char *)malloc(wsize * max_bytes + 1)) == NULL) { | ||
22 | + buffer_size = wsize * max_bytes + 1; | ||
23 | + if ((buffer = (char *)malloc(buffer_size)) == NULL) { | ||
24 | return NULL; | ||
25 | } | ||
26 | |||
27 | @@ -2552,7 +2554,11 @@ char *wide_to_local_string(wide_string, escape_all) | ||
28 | /* no MB for this wide */ | ||
29 | /* use escape for wide character */ | ||
30 | char *escape_string = wide_to_escape_string(wide_string[i]); | ||
31 | - strcat(buffer, escape_string); | ||
32 | + size_t buffer_len = strlen(buffer); | ||
33 | + size_t escape_string_len = strlen(escape_string); | ||
34 | + if (buffer_len + escape_string_len + 1 > buffer_size) | ||
35 | + escape_string_len = buffer_size - buffer_len - 1; | ||
36 | + strncat(buffer, escape_string, escape_string_len); | ||
37 | free(escape_string); | ||
38 | } | ||
39 | } | ||
diff --git a/meta/recipes-extended/unzip/unzip/CVE-2022-0530.patch b/meta/recipes-extended/unzip/unzip/CVE-2022-0530.patch new file mode 100644 index 0000000000..363dafddc9 --- /dev/null +++ b/meta/recipes-extended/unzip/unzip/CVE-2022-0530.patch | |||
@@ -0,0 +1,33 @@ | |||
1 | https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1010355 | ||
2 | |||
3 | CVE: CVE-2022-0530 | ||
4 | Upstream-Status: Inactive-Upstream [need a new release] | ||
5 | |||
6 | diff --git a/fileio.c b/fileio.c | ||
7 | index 6290824..77e4b5f 100644 | ||
8 | --- a/fileio.c | ||
9 | +++ b/fileio.c | ||
10 | @@ -2361,6 +2361,9 @@ int do_string(__G__ length, option) /* return PK-type error code */ | ||
11 | /* convert UTF-8 to local character set */ | ||
12 | fn = utf8_to_local_string(G.unipath_filename, | ||
13 | G.unicode_escape_all); | ||
14 | + if (fn == NULL) | ||
15 | + return PK_ERR; | ||
16 | + | ||
17 | /* make sure filename is short enough */ | ||
18 | if (strlen(fn) >= FILNAMSIZ) { | ||
19 | fn[FILNAMSIZ - 1] = '\0'; | ||
20 | diff --git a/process.c b/process.c | ||
21 | index d2a846e..715bc0f 100644 | ||
22 | --- a/process.c | ||
23 | +++ b/process.c | ||
24 | @@ -2605,6 +2605,8 @@ char *utf8_to_local_string(utf8_string, escape_all) | ||
25 | int escape_all; | ||
26 | { | ||
27 | zwchar *wide = utf8_to_wide_string(utf8_string); | ||
28 | + if (wide == NULL) | ||
29 | + return NULL; | ||
30 | char *loc = wide_to_local_string(wide, escape_all); | ||
31 | free(wide); | ||
32 | return loc; | ||
33 | |||
diff --git a/meta/recipes-extended/unzip/unzip_6.0.bb b/meta/recipes-extended/unzip/unzip_6.0.bb index c222a684b4..f35856cf61 100644 --- a/meta/recipes-extended/unzip/unzip_6.0.bb +++ b/meta/recipes-extended/unzip/unzip_6.0.bb | |||
@@ -29,6 +29,8 @@ SRC_URI = "${SOURCEFORGE_MIRROR}/infozip/UnZip%206.x%20%28latest%29/UnZip%206.0/ | |||
29 | file://unzip_optimization.patch \ | 29 | file://unzip_optimization.patch \ |
30 | file://0001-configure-Pass-LDFLAGS-to-tests-doing-link-step.patch \ | 30 | file://0001-configure-Pass-LDFLAGS-to-tests-doing-link-step.patch \ |
31 | file://CVE-2021-4217.patch \ | 31 | file://CVE-2021-4217.patch \ |
32 | file://CVE-2022-0529.patch \ | ||
33 | file://CVE-2022-0530.patch \ | ||
32 | " | 34 | " |
33 | UPSTREAM_VERSION_UNKNOWN = "1" | 35 | UPSTREAM_VERSION_UNKNOWN = "1" |
34 | 36 | ||