diff --git a/SOURCES/tar-1.30-xgetcwd-null-return-check.patch b/SOURCES/tar-1.30-xgetcwd-null-return-check.patch new file mode 100644 index 0000000..1359e06 --- /dev/null +++ b/SOURCES/tar-1.30-xgetcwd-null-return-check.patch @@ -0,0 +1,50 @@ +From 60acf5a7407ef263aaf7d3751da08167b1990eb0 Mon Sep 17 00:00:00 2001 +From: Sergey Poznyakoff +Date: Wed, 20 May 2020 13:35:28 +0200 +Subject: [PATCH] Check return value from xgetcwd + +* src/misc.c (chdir_arg,tar_getcdpath): Check for non-NULL +return from xgetcwd. The function returns NULL for any +error originating from getcwd. +--- + src/misc.c | 10 +++++++--- + 1 file changed, 7 insertions(+), 3 deletions(-) + +diff --git a/src/misc.c b/src/misc.c +index cd07f53..eccf6f9 100644 +--- a/src/misc.c ++++ b/src/misc.c +@@ -301,8 +301,6 @@ normalize_filename (int cdidx, const char *name) + size_t copylen; + bool need_separator; + +- if (!cdpath) +- call_arg_fatal ("getcwd", "."); + copylen = strlen (cdpath); + need_separator = ! (DOUBLE_SLASH_IS_DISTINCT_ROOT + && copylen == 2 && ISSLASH (cdpath[1])); +@@ -909,6 +907,8 @@ chdir_arg (char const *dir) + { + wd[wd_count].name = "."; + wd[wd_count].abspath = xgetcwd (); ++ if (!wd[wd_count].abspath) ++ call_arg_fatal ("getcwd", "."); + wd[wd_count].fd = AT_FDCWD; + wd_count++; + } +@@ -1034,7 +1034,11 @@ tar_getcdpath (int idx) + { + static char *cwd; + if (!cwd) +- cwd = xgetcwd (); ++ { ++ cwd = xgetcwd (); ++ if (!cwd) ++ call_arg_fatal ("getcwd", "."); ++ } + return cwd; + } + return wd[idx].abspath; +-- +2.24.1 + diff --git a/SPECS/tar.spec b/SPECS/tar.spec index ec00f9b..26a92ff 100644 --- a/SPECS/tar.spec +++ b/SPECS/tar.spec @@ -6,7 +6,7 @@ Summary: A GNU file archiving program Name: tar Epoch: 2 Version: 1.30 -Release: 4%{?dist} +Release: 5%{?dist} License: GPLv3+ Group: Applications/Archiving URL: http://www.gnu.org/software/tar/ @@ -23,6 +23,7 @@ Patch9: tar-1.28-document-exclude-mistakes.patch Patch11: tar-1.28-sparse-inf-loops.patch Patch12: tar-1.30-tests-difflink.patch Patch13: tar-1.30-tests-dirrem.patch +Patch14: tar-1.30-xgetcwd-null-return-check.patch # run "make check" by default %bcond_without check @@ -128,6 +129,9 @@ fi %{_infodir}/tar.info* %changelog +* Wed May 20 2020 Ondrej Dubaj - 1.30-5 +- fixed NULL return value from xgetcwd (#1837871) + * Wed May 23 2018 Pavel Raiskup - 1.30-4 - drop BuildRequires: rsh, we anyways use ./configure RSH=%%_bindir/ssh