summaryrefslogtreecommitdiffstats
path: root/meta/recipes-extended/cpio/cpio-2.12/0001-Fix-segfault-with-append.patch
diff options
context:
space:
mode:
Diffstat (limited to 'meta/recipes-extended/cpio/cpio-2.12/0001-Fix-segfault-with-append.patch')
-rw-r--r--meta/recipes-extended/cpio/cpio-2.12/0001-Fix-segfault-with-append.patch51
1 files changed, 0 insertions, 51 deletions
diff --git a/meta/recipes-extended/cpio/cpio-2.12/0001-Fix-segfault-with-append.patch b/meta/recipes-extended/cpio/cpio-2.12/0001-Fix-segfault-with-append.patch
deleted file mode 100644
index ec8b303c43..0000000000
--- a/meta/recipes-extended/cpio/cpio-2.12/0001-Fix-segfault-with-append.patch
+++ /dev/null
@@ -1,51 +0,0 @@
1Upstream-Status: Backport
2Signed-off-by: Ross Burton <ross.burton@intel.com>
3
4From 32d95fe0c90c59352a0ce3102fc9866cbfb0f629 Mon Sep 17 00:00:00 2001
5From: Sergey Poznyakoff <gray@gnu.org>
6Date: Sat, 1 Dec 2018 11:40:02 +0200
7Subject: [PATCH] Fix sigfault when appending to archive
8
9Bug reported by Ross Burton. See
10<http://lists.gnu.org/archive/html/bug-cpio/2018-11/msg00000.html>
11
12* src/util.c: Keep static copy of the buffer pointer; always
13assign it to file_hdr->c_name. Use x2realloc for memory management.
14---
15 src/util.c | 17 ++++-------------
16 1 file changed, 4 insertions(+), 13 deletions(-)
17
18diff --git a/src/util.c b/src/util.c
19index 10486dc..4e49124 100644
20--- a/src/util.c
21+++ b/src/util.c
22@@ -1413,22 +1413,13 @@ set_file_times (int fd,
23 void
24 cpio_set_c_name (struct cpio_file_stat *file_hdr, char *name)
25 {
26+ static char *buf = NULL;
27 static size_t buflen = 0;
28 size_t len = strlen (name) + 1;
29
30- if (buflen == 0)
31- {
32- buflen = len;
33- if (buflen < 32)
34- buflen = 32;
35- file_hdr->c_name = xmalloc (buflen);
36- }
37- else if (buflen < len)
38- {
39- buflen = len;
40- file_hdr->c_name = xrealloc (file_hdr->c_name, buflen);
41- }
42-
43+ while (buflen < len)
44+ buf = x2realloc (buf, &buflen);
45+ file_hdr->c_name = buf;
46 file_hdr->c_namesize = len;
47 memmove (file_hdr->c_name, name, len);
48 }
49--
502.18.0
51