summaryrefslogtreecommitdiffstats
path: root/meta/recipes-extended/tar/tar/CVE-2016-6321.patch
diff options
context:
space:
mode:
Diffstat (limited to 'meta/recipes-extended/tar/tar/CVE-2016-6321.patch')
-rw-r--r--meta/recipes-extended/tar/tar/CVE-2016-6321.patch66
1 files changed, 66 insertions, 0 deletions
diff --git a/meta/recipes-extended/tar/tar/CVE-2016-6321.patch b/meta/recipes-extended/tar/tar/CVE-2016-6321.patch
new file mode 100644
index 0000000000..6d35bcc513
--- /dev/null
+++ b/meta/recipes-extended/tar/tar/CVE-2016-6321.patch
@@ -0,0 +1,66 @@
1From 7340f67b9860ea0531c1450e5aa261c50f67165d Mon Sep 17 00:00:00 2001
2From: Paul Eggert <eggert@Penguin.CS.UCLA.EDU>
3Date: Sat, 29 Oct 2016 21:04:40 -0700
4Subject: [PATCH] When extracting, skip ".." members
5
6* NEWS: Document this.
7* src/extract.c (extract_archive): Skip members whose names
8contain "..".
9
10CVE: CVE-2016-6321
11Upstream-Status: Backport
12
13Cherry picked from commit: 7340f67 When extracting, skip ".." members
14
15Signed-off-by: Sona Sarmadi <sona.sarmadi@enea.com>
16---
17 NEWS | 8 +++++++-
18 src/extract.c | 8 ++++++++
19 2 files changed, 15 insertions(+), 1 deletion(-)
20
21diff --git a/NEWS b/NEWS
22index 501164a..fc97cfc 100644
23--- a/NEWS
24+++ b/NEWS
25@@ -1,6 +1,12 @@
26-GNU tar NEWS - User visible changes. 2016-05-16
27+GNU tar NEWS - User visible changes. 2016-10-29
28 Please send GNU tar bug reports to <bug-tar@gnu.org>
29
30+* Member names containing '..' components are now skipped when extracting.
31+
32+This fixes tar's behavior to match its documentation, and is a bit
33+safer when extracting untrusted archives over old files (an unsafe
34+practice that the tar manual has long recommended against).
35+
36
37 version 1.29 - Sergey Poznyakoff, 2016-05-16
38
39diff --git a/src/extract.c b/src/extract.c
40index f982433..7904148 100644
41--- a/src/extract.c
42+++ b/src/extract.c
43@@ -1629,12 +1629,20 @@ extract_archive (void)
44 {
45 char typeflag;
46 tar_extractor_t fun;
47+ bool skip_dotdot_name;
48
49 fatal_exit_hook = extract_finish;
50
51 set_next_block_after (current_header);
52
53+ skip_dotdot_name = (!absolute_names_option
54+ && contains_dot_dot (current_stat_info.orig_file_name));
55+ if (skip_dotdot_name)
56+ ERROR ((0, 0, _("%s: Member name contains '..'"),
57+ quotearg_colon (current_stat_info.orig_file_name)));
58+
59 if (!current_stat_info.file_name[0]
60+ || skip_dotdot_name
61 || (interactive_option
62 && !confirm ("extract", current_stat_info.file_name)))
63 {
64--
651.9.1
66