summaryrefslogtreecommitdiffstats
path: root/meta/recipes-devtools/squashfs-tools/files/CVE-2021-41072-requisite-2.patch
diff options
context:
space:
mode:
Diffstat (limited to 'meta/recipes-devtools/squashfs-tools/files/CVE-2021-41072-requisite-2.patch')
-rw-r--r--meta/recipes-devtools/squashfs-tools/files/CVE-2021-41072-requisite-2.patch109
1 files changed, 109 insertions, 0 deletions
diff --git a/meta/recipes-devtools/squashfs-tools/files/CVE-2021-41072-requisite-2.patch b/meta/recipes-devtools/squashfs-tools/files/CVE-2021-41072-requisite-2.patch
new file mode 100644
index 0000000000..0b80d07b3b
--- /dev/null
+++ b/meta/recipes-devtools/squashfs-tools/files/CVE-2021-41072-requisite-2.patch
@@ -0,0 +1,109 @@
1The commit is required by the fix for CVE-2021-41072. Update context for
2version 4.4.
3
4Upstream-Status: Backport [https://github.com/plougher/squashfs-tools/commit/1993a4e]
5
6Signed-off-by: Kai Kang <kai.kang@windriver.com>
7
8From 1993a4e7aeda04962bf26e84c15fba8b58837e10 Mon Sep 17 00:00:00 2001
9From: Phillip Lougher <phillip@squashfs.org.uk>
10Date: Sun, 12 Sep 2021 20:09:13 +0100
11Subject: [PATCH] unsquashfs: dynamically allocate name
12
13Dynamically allocate name rather than store it
14directly in structure.
15
16Signed-off-by: Phillip Lougher <phillip@squashfs.org.uk>
17---
18 squashfs-tools/unsquash-1.c | 2 +-
19 squashfs-tools/unsquash-1234.c | 5 +++++
20 squashfs-tools/unsquash-2.c | 2 +-
21 squashfs-tools/unsquash-3.c | 2 +-
22 squashfs-tools/unsquash-4.c | 2 +-
23 squashfs-tools/unsquashfs.h | 2 +-
24 6 files changed, 10 insertions(+), 5 deletions(-)
25
26diff --git a/squashfs-tools/unsquash-1.c b/squashfs-tools/unsquash-1.c
27index 7598499..d0121c6 100644
28--- a/squashfs-tools/unsquash-1.c
29+++ b/squashfs-tools/unsquash-1.c
30@@ -303,7 +303,7 @@ static struct dir *squashfs_opendir(unsi
31 "realloc failed!\n");
32 dir->dirs = new_dir;
33 }
34- strcpy(dir->dirs[dir->dir_count].name, dire->name);
35+ dir->dirs[dir->dir_count].name = strdup(dire->name);
36 dir->dirs[dir->dir_count].start_block =
37 dirh.start_block;
38 dir->dirs[dir->dir_count].offset = dire->offset;
39diff --git a/squashfs-tools/unsquash-1234.c b/squashfs-tools/unsquash-1234.c
40index 0c8dfbb..ac46d9d 100644
41--- a/squashfs-tools/unsquash-1234.c
42+++ b/squashfs-tools/unsquash-1234.c
43@@ -60,6 +60,11 @@ int check_name(char *name, int size)
44
45 void squashfs_closedir(struct dir *dir)
46 {
47+ int i;
48+
49+ for(i = 0; i < dir->dir_count; i++)
50+ free(dir->dirs[i].name);
51+
52 free(dir->dirs);
53 free(dir);
54 }
55diff --git a/squashfs-tools/unsquash-2.c b/squashfs-tools/unsquash-2.c
56index 86f62ba..e847980 100644
57--- a/squashfs-tools/unsquash-2.c
58+++ b/squashfs-tools/unsquash-2.c
59@@ -404,7 +404,7 @@ static struct dir *squashfs_opendir(unsi
60 "realloc failed!\n");
61 dir->dirs = new_dir;
62 }
63- strcpy(dir->dirs[dir->dir_count].name, dire->name);
64+ dir->dirs[dir->dir_count].name = strdup(dire->name);
65 dir->dirs[dir->dir_count].start_block =
66 dirh.start_block;
67 dir->dirs[dir->dir_count].offset = dire->offset;
68diff --git a/squashfs-tools/unsquash-3.c b/squashfs-tools/unsquash-3.c
69index c04aa9e..8223f27 100644
70--- a/squashfs-tools/unsquash-3.c
71+++ b/squashfs-tools/unsquash-3.c
72@@ -431,7 +431,7 @@ static struct dir *squashfs_opendir(unsi
73 "realloc failed!\n");
74 dir->dirs = new_dir;
75 }
76- strcpy(dir->dirs[dir->dir_count].name, dire->name);
77+ dir->dirs[dir->dir_count].name = strdup(dire->name);
78 dir->dirs[dir->dir_count].start_block =
79 dirh.start_block;
80 dir->dirs[dir->dir_count].offset = dire->offset;
81diff --git a/squashfs-tools/unsquash-4.c b/squashfs-tools/unsquash-4.c
82index ff62dcc..1e199a7 100644
83--- a/squashfs-tools/unsquash-4.c
84+++ b/squashfs-tools/unsquash-4.c
85@@ -367,7 +367,7 @@ static struct dir *squashfs_opendir(unsi
86 "realloc failed!\n");
87 dir->dirs = new_dir;
88 }
89- strcpy(dir->dirs[dir->dir_count].name, dire->name);
90+ dir->dirs[dir->dir_count].name = strdup(dire->name);
91 dir->dirs[dir->dir_count].start_block =
92 dirh.start_block;
93 dir->dirs[dir->dir_count].offset = dire->offset;
94diff --git a/squashfs-tools/unsquashfs.h b/squashfs-tools/unsquashfs.h
95index 5ecb2ab..583fbe4 100644
96--- a/squashfs-tools/unsquashfs.h
97+++ b/squashfs-tools/unsquashfs.h
98@@ -165,7 +165,7 @@ struct queue {
99 #define DIR_ENT_SIZE 16
100
101 struct dir_ent {
102- char name[SQUASHFS_NAME_LEN + 1];
103+ char *name;
104 unsigned int start_block;
105 unsigned int offset;
106 unsigned int type;
107--
1082.17.1
109