0783473763b46a0bbace1cde45a19a3fddb1f054
[librecmc/package-feed.git] / utils / tar / patches / 001-CVE-2016-6321.patch
1 From 7340f67b9860ea0531c1450e5aa261c50f67165d Mon Sep 17 00:00:00 2001
2 From: Paul Eggert <eggert@Penguin.CS.UCLA.EDU>
3 Date: Sat, 29 Oct 2016 21:04:40 -0700
4 Subject: When extracting, skip ".." members
5
6 * src/extract.c (extract_archive): Skip members whose names
7 contain "..".
8 --- a/src/extract.c
9 +++ b/src/extract.c
10 @@ -1629,12 +1629,20 @@ extract_archive (void)
11  {
12    char typeflag;
13    tar_extractor_t fun;
14 +  bool skip_dotdot_name;
15  
16    fatal_exit_hook = extract_finish;
17  
18    set_next_block_after (current_header);
19  
20 +  skip_dotdot_name = (!absolute_names_option
21 +                     && contains_dot_dot (current_stat_info.orig_file_name));
22 +  if (skip_dotdot_name)
23 +    ERROR ((0, 0, _("%s: Member name contains '..'"),
24 +           quotearg_colon (current_stat_info.orig_file_name)));
25 +
26    if (!current_stat_info.file_name[0]
27 +      || skip_dotdot_name
28        || (interactive_option
29           && !confirm ("extract", current_stat_info.file_name)))
30      {