summaryrefslogtreecommitdiffstats
path: root/meta-oe/recipes-support/libtar/files/CVE-2021-33643-CVE-2021-33644.patch
diff options
context:
space:
mode:
Diffstat (limited to 'meta-oe/recipes-support/libtar/files/CVE-2021-33643-CVE-2021-33644.patch')
-rw-r--r--meta-oe/recipes-support/libtar/files/CVE-2021-33643-CVE-2021-33644.patch52
1 files changed, 52 insertions, 0 deletions
diff --git a/meta-oe/recipes-support/libtar/files/CVE-2021-33643-CVE-2021-33644.patch b/meta-oe/recipes-support/libtar/files/CVE-2021-33643-CVE-2021-33644.patch
new file mode 100644
index 0000000000..a61cc3b6a9
--- /dev/null
+++ b/meta-oe/recipes-support/libtar/files/CVE-2021-33643-CVE-2021-33644.patch
@@ -0,0 +1,52 @@
1From c778d234c396e78bacef7c9bff0dd2bb9fb6aac8 Mon Sep 17 00:00:00 2001
2From: shixuantong <1726671442@qq.com>
3Date: Wed, 6 Apr 2022 17:40:57 +0800
4Subject: [PATCH] Ensure that sz is greater than 0.
5
6Authored by shixuantong <1726671442@qq.com>.
7
8meta-openembedded uses Debian's release tarball [1]. Debian uses
9repo.or.cz/libtar.git as their upstream [2]. repo.or.cz/libtar.git has
10been inactive since 2013 [3].
11
12CVE: CVE-2021-33643 CVE-2021-33644
13
14Upstream-Status: Inactive-Upstream [lastrelease: 2013 lastcommit: 2013]
15
16[1] https://git.openembedded.org/meta-openembedded/tree/meta-oe/recipes-support/libtar/libtar_1.2.20.bb?h=master#n8
17[2] http://svn.kibibyte.se/libtar/trunk/debian/control (rev 51; not tagged)
18[3] https://repo.or.cz/libtar.git/shortlog/refs/heads/master
19
20Signed-off-by: Katariina Lounento <katariina.lounento@vaisala.com>
21---
22 lib/block.c | 10 ++++++++++
23 1 file changed, 10 insertions(+)
24
25diff --git a/lib/block.c b/lib/block.c
26index 092bc28..f12c4bc 100644
27--- a/lib/block.c
28+++ b/lib/block.c
29@@ -118,6 +118,11 @@ th_read(TAR *t)
30 if (TH_ISLONGLINK(t))
31 {
32 sz = th_get_size(t);
33+ if ((int)sz <= 0)
34+ {
35+ errno = EINVAL;
36+ return -1;
37+ }
38 blocks = (sz / T_BLOCKSIZE) + (sz % T_BLOCKSIZE ? 1 : 0);
39 if (blocks > ((size_t)-1 / T_BLOCKSIZE))
40 {
41@@ -168,6 +173,11 @@ th_read(TAR *t)
42 if (TH_ISLONGNAME(t))
43 {
44 sz = th_get_size(t);
45+ if ((int)sz <= 0)
46+ {
47+ errno = EINVAL;
48+ return -1;
49+ }
50 blocks = (sz / T_BLOCKSIZE) + (sz % T_BLOCKSIZE ? 1 : 0);
51 if (blocks > ((size_t)-1 / T_BLOCKSIZE))
52 {