summaryrefslogtreecommitdiffstats
path: root/meta/recipes-extended/cpio/cpio-2.8
diff options
context:
space:
mode:
Diffstat (limited to 'meta/recipes-extended/cpio/cpio-2.8')
-rw-r--r--meta/recipes-extended/cpio/cpio-2.8/avoid_heap_overflow.patch26
-rw-r--r--meta/recipes-extended/cpio/cpio-2.8/fix-memory-overrun.patch217
-rw-r--r--meta/recipes-extended/cpio/cpio-2.8/m4extensions.patch31
-rw-r--r--meta/recipes-extended/cpio/cpio-2.8/statdef.patch15
4 files changed, 0 insertions, 289 deletions
diff --git a/meta/recipes-extended/cpio/cpio-2.8/avoid_heap_overflow.patch b/meta/recipes-extended/cpio/cpio-2.8/avoid_heap_overflow.patch
deleted file mode 100644
index a31573510a..0000000000
--- a/meta/recipes-extended/cpio/cpio-2.8/avoid_heap_overflow.patch
+++ /dev/null
@@ -1,26 +0,0 @@
1Upstream-Status: Inappropriate [bugfix: http://web.nvd.nist.gov/view/vuln/detail?vulnId=CVE-2010-0624]
2CVE: CVE-2010-0624
3
4This patch avoids heap overflow reported by :
5http://web.nvd.nist.gov/view/vuln/detail?vulnId=CVE-2010-0624
6
7This is a clean patch for the GPLv2 tar recipe.
8
9the GPLv2 tar recipe patch is also applicable to this GPLv2 cpio
10recipe, as they share code.
11
12Nitin A Kamble <nitin.a.kamble@intel.com> 2011/04/25
13
14Index: tar-1.17/lib/rtapelib.c
15===================================================================
16--- tar-1.17.orig/lib/rtapelib.c
17+++ tar-1.17/lib/rtapelib.c
18@@ -570,7 +570,7 @@ rmt_read__ (int handle, char *buffer, si
19
20 sprintf (command_buffer, "R%lu\n", (unsigned long) length);
21 if (do_command (handle, command_buffer) == -1
22- || (status = get_status (handle)) == SAFE_READ_ERROR)
23+ || ((status = get_status (handle)) == SAFE_READ_ERROR) || (status > length))
24 return SAFE_READ_ERROR;
25
26 for (counter = 0; counter < status; counter += rlen, buffer += rlen)
diff --git a/meta/recipes-extended/cpio/cpio-2.8/fix-memory-overrun.patch b/meta/recipes-extended/cpio/cpio-2.8/fix-memory-overrun.patch
deleted file mode 100644
index 0148e70797..0000000000
--- a/meta/recipes-extended/cpio/cpio-2.8/fix-memory-overrun.patch
+++ /dev/null
@@ -1,217 +0,0 @@
1cpio: Fix memory overrun on reading improperly created link records
2
3Signed-off-by: Bian Naimeng <biannm@cn.fujitsu.com>
4
5http://git.savannah.gnu.org/cgit/cpio.git/commit/?id=746f3ff670dcfcdd28fcc990e79cd6fccc7ae48d
6
7 * src/copyin.c (get_link_name): New function.
8 (list_file, copyin_link): use get_link_name
9
10 * tests/symlink-bad-length.at: New file.
11 * tests/symlink-long.at: New file.
12 * tests/Makefile.am: Add new files.
13 * tests/testsuite.at: Likewise.
14
15 See http://lists.gnu.org/archive/html/bug-cpio/2014-11/msg00007.html
16
17Upstream-Status: Backport
18
19Signed-off-by: Sergey Poznyakoff <gray@gnu.org.ua>
20
21diff -Nurp cpio-2.8.orig/src/copyin.c cpio-2.8/src/copyin.c
22--- cpio-2.8.orig/src/copyin.c 2007-06-07 19:58:03.000000000 +0800
23+++ cpio-2.8/src/copyin.c 2014-12-08 11:30:01.159791484 +0800
24@@ -126,6 +126,28 @@ tape_skip_padding (int in_file_des, int
25 }
26
27
28+static char *
29+get_link_name (struct cpio_file_stat *file_hdr, int in_file_des)
30+{
31+ off_t n = file_hdr->c_filesize + 1;
32+ char *link_name;
33+
34+ if (n == 0 || n > SIZE_MAX)
35+ {
36+ error (0, 0, _("%s: stored filename length too big"), file_hdr->c_name);
37+ link_name = NULL;
38+ }
39+ else
40+ {
41+ link_name = xmalloc (n);
42+ tape_buffered_read (link_name, in_file_des, file_hdr->c_filesize);
43+ link_name[file_hdr->c_filesize] = '\0';
44+ tape_skip_padding (in_file_des, file_hdr->c_filesize);
45+ }
46+ return link_name;
47+}
48+
49+
50 static void
51 list_file(struct cpio_file_stat* file_hdr, int in_file_des)
52 {
53@@ -136,21 +158,16 @@ list_file(struct cpio_file_stat* file_hd
54 {
55 if (archive_format != arf_tar && archive_format != arf_ustar)
56 {
57- char *link_name = NULL; /* Name of hard and symbolic links. */
58-
59- link_name = (char *) xmalloc ((unsigned int) file_hdr->c_filesize + 1);
60- link_name[file_hdr->c_filesize] = '\0';
61- tape_buffered_read (link_name, in_file_des, file_hdr->c_filesize);
62- long_format (file_hdr, link_name);
63- free (link_name);
64- tape_skip_padding (in_file_des, file_hdr->c_filesize);
65- return;
66+ char *link_name = get_link_name (file_hdr, in_file_des);
67+ if (link_name)
68+ {
69+ long_format (file_hdr, link_name);
70+ free (link_name);
71+ }
72 }
73 else
74- {
75 long_format (file_hdr, file_hdr->c_tar_linkname);
76- return;
77- }
78+ return;
79 }
80 else
81 #endif
82@@ -732,10 +749,7 @@ copyin_link(struct cpio_file_stat *file_
83
84 if (archive_format != arf_tar && archive_format != arf_ustar)
85 {
86- link_name = (char *) xmalloc ((unsigned int) file_hdr->c_filesize + 1);
87- link_name[file_hdr->c_filesize] = '\0';
88- tape_buffered_read (link_name, in_file_des, file_hdr->c_filesize);
89- tape_skip_padding (in_file_des, file_hdr->c_filesize);
90+ link_name = get_link_name (file_hdr, in_file_des);
91 }
92 else
93 {
94diff -Nurp cpio-2.8.orig/tests/Makefile.am cpio-2.8/tests/Makefile.am
95--- cpio-2.8.orig/tests/Makefile.am 2006-10-24 18:32:13.000000000 +0800
96+++ cpio-2.8/tests/Makefile.am 2014-12-08 11:30:52.387789482 +0800
97@@ -45,6 +45,8 @@ TESTSUITE_AT = \
98 testsuite.at\
99 inout.at\
100 symlink.at\
101+ symlink-bad-length.at\
102+ symlink-long.at\
103 version.at
104
105 TESTSUITE = $(srcdir)/testsuite
106diff -Nurp cpio-2.8.orig/tests/symlink-bad-length.at cpio-2.8/tests/symlink-bad-length.at
107--- cpio-2.8.orig/tests/symlink-bad-length.at 1970-01-01 08:00:00.000000000 +0800
108+++ cpio-2.8/tests/symlink-bad-length.at 2014-12-08 11:33:25.283783507 +0800
109@@ -0,0 +1,49 @@
110+# Process this file with autom4te to create testsuite. -*- Autotest -*-
111+# Copyright (C) 2014 Free Software Foundation, Inc.
112+
113+# This program is free software; you can redistribute it and/or modify
114+# it under the terms of the GNU General Public License as published by
115+# the Free Software Foundation; either version 3, or (at your option)
116+# any later version.
117+
118+# This program is distributed in the hope that it will be useful,
119+# but WITHOUT ANY WARRANTY; without even the implied warranty of
120+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
121+# GNU General Public License for more details.
122+
123+# You should have received a copy of the GNU General Public License
124+# along with this program; if not, write to the Free Software
125+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
126+# 02110-1301 USA.
127+
128+# Cpio v2.11 did segfault with badly set symlink length.
129+# References:
130+# http://lists.gnu.org/archive/html/bug-cpio/2014-11/msg00007.html
131+
132+AT_SETUP([symlink-bad-length])
133+AT_KEYWORDS([symlink-long copyout])
134+
135+AT_DATA([ARCHIVE.base64],
136+[x3EjAIBAtIEtJy8nAQAAAHRUYW0FAAAADQBGSUxFAABzb21lIGNvbnRlbnQKAMdxIwBgQ/+hLScv
137+JwEAAAB0VEhuBQD/////TElOSwAARklMRcdxAAAAAAAAAAAAAAEAAAAAAAAACwAAAAAAVFJBSUxF
138+UiEhIQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
139+AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
140+AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
141+AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
142+AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
143+AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
144+AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=
145+])
146+
147+AT_CHECK([
148+base64 -d ARCHIVE.base64 > ARCHIVE || AT_SKIP_TEST
149+cpio -ntv < ARCHIVE
150+test $? -eq 2
151+],
152+[0],
153+[-rw-rw-r-- 1 10029 10031 13 Nov 25 13:52 FILE
154+],[cpio: LINK: stored filename length too big
155+cpio: premature end of file
156+])
157+
158+AT_CLEANUP
159diff -Nurp cpio-2.8.orig/tests/symlink-long.at cpio-2.8/tests/symlink-long.at
160--- cpio-2.8.orig/tests/symlink-long.at 1970-01-01 08:00:00.000000000 +0800
161+++ cpio-2.8/tests/symlink-long.at 2014-12-08 11:34:28.807781024 +0800
162@@ -0,0 +1,46 @@
163+# Process this file with autom4te to create testsuite. -*- Autotest -*-
164+# Copyright (C) 2014 Free Software Foundation, Inc.
165+
166+# This program is free software; you can redistribute it and/or modify
167+# it under the terms of the GNU General Public License as published by
168+# the Free Software Foundation; either version 3, or (at your option)
169+# any later version.
170+
171+# This program is distributed in the hope that it will be useful,
172+# but WITHOUT ANY WARRANTY; without even the implied warranty of
173+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
174+# GNU General Public License for more details.
175+
176+# You should have received a copy of the GNU General Public License
177+# along with this program; if not, write to the Free Software
178+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
179+# 02110-1301 USA.
180+
181+# Cpio v2.11.90 changed the way symlink name is read from archive.
182+# References:
183+# http://lists.gnu.org/archive/html/bug-cpio/2014-11/msg00007.html
184+
185+AT_SETUP([symlink-long])
186+AT_KEYWORDS([symlink-long copyout])
187+
188+AT_CHECK([
189+
190+# len(dirname) > READBUFSIZE
191+dirname=
192+for i in {1..52}; do
193+ dirname="xxxxxxxxx/$dirname"
194+ mkdir "$dirname"
195+done
196+ln -s "$dirname" x || AT_SKIP_TEST
197+
198+echo x | cpio -o > ar
199+list=`cpio -tv < ar | sed 's|.*-> ||'`
200+test "$list" = "$dirname" && echo success || echo fail
201+],
202+[0],
203+[success
204+],[2 blocks
205+2 blocks
206+])
207+
208+AT_CLEANUP
209diff -Nurp cpio-2.8.orig/tests/testsuite.at cpio-2.8/tests/testsuite.at
210--- cpio-2.8.orig/tests/testsuite.at 2006-10-24 18:32:13.000000000 +0800
211+++ cpio-2.8/tests/testsuite.at 2014-12-08 11:34:56.515779942 +0800
212@@ -31,3 +31,5 @@ m4_include([version.at])
213
214 m4_include([inout.at])
215 m4_include([symlink.at])
216+m4_include([symlink-bad-length.at])
217+m4_include([symlink-long.at])
diff --git a/meta/recipes-extended/cpio/cpio-2.8/m4extensions.patch b/meta/recipes-extended/cpio/cpio-2.8/m4extensions.patch
deleted file mode 100644
index e16585dd3f..0000000000
--- a/meta/recipes-extended/cpio/cpio-2.8/m4extensions.patch
+++ /dev/null
@@ -1,31 +0,0 @@
1Upstream-Status: Inappropriate [licensing]
2
3# Define AC_USE_SYSTEM_EXTENSIONS only if it was previously undefined.
4# This is needed to configure correctly with newer versions of autoconf.
5
6diff -urN cpio-2.8.orig/m4/extensions.m4 cpio-2.8/m4/extensions.m4
7--- cpio-2.8.orig/m4/extensions.m4 2006-10-12 04:34:45.000000000 -0700
8+++ cpio-2.8/m4/extensions.m4 2010-07-23 14:37:36.000000000 -0700
9@@ -1,4 +1,4 @@
10-# serial 4 -*- Autoconf -*-
11+# serial 5 -*- Autoconf -*-
12 # Enable extensions on systems that normally disable them.
13
14 # Copyright (C) 2003, 2006 Free Software Foundation, Inc.
15@@ -16,6 +16,7 @@
16 # ------------------------
17 # Enable extensions on systems that normally disable them,
18 # typically due to standards-conformance issues.
19+m4_ifdef([AC_USE_SYSTEM_EXTENSIONS], [], [
20 AC_DEFUN([AC_USE_SYSTEM_EXTENSIONS],
21 [
22 AC_BEFORE([$0], [AC_COMPILE_IFELSE])
23@@ -48,7 +49,7 @@
24 AC_DEFINE([__EXTENSIONS__])
25 AC_DEFINE([_POSIX_PTHREAD_SEMANTICS])
26 AC_DEFINE([_TANDEM_SOURCE])
27-])
28+])])
29
30 # gl_USE_SYSTEM_EXTENSIONS
31 # ------------------------
diff --git a/meta/recipes-extended/cpio/cpio-2.8/statdef.patch b/meta/recipes-extended/cpio/cpio-2.8/statdef.patch
deleted file mode 100644
index a00799fea9..0000000000
--- a/meta/recipes-extended/cpio/cpio-2.8/statdef.patch
+++ /dev/null
@@ -1,15 +0,0 @@
1Upstream-Status: Inappropriate [licensing]
2
3# Avoid multiple stat definitions
4# Patch taken from cpio mailing list posting 2010-03-19
5
6diff -urN cpio-2.11.orig/src/filetypes.h cpio-2.11/src/filetypes.h
7--- cpio-2.11.orig/src/filetypes.h 2010-02-12 02:19:23.000000000 -0800
8+++ cpio-2.11/src/filetypes.h 2010-07-23 13:17:25.000000000 -0700
9@@ -82,4 +82,6 @@
10 #define lstat stat
11 #endif
12 int lstat ();
13+#ifndef stat
14 int stat ();
15+#endif