diff --git a/cpio-2.10-patternnamesigsegv.patch b/cpio-2.10-patternnamesigsegv.patch new file mode 100644 index 0000000..c3b9420 --- /dev/null +++ b/cpio-2.10-patternnamesigsegv.patch @@ -0,0 +1,41 @@ +diff -urNp cpio-2.10-orig/src/copyin.c cpio-2.10/src/copyin.c +--- cpio-2.10-orig/src/copyin.c 2010-02-22 12:57:59.000000000 +0100 ++++ cpio-2.10/src/copyin.c 2010-02-22 12:55:26.000000000 +0100 +@@ -944,20 +944,23 @@ read_pattern_file () + pattern_fp = fopen (pattern_file_name, "r"); + if (pattern_fp == NULL) + open_error (pattern_file_name); +- while (ds_fgetstr (pattern_fp, &pattern_name, '\n') != NULL) +- { +- if (new_num_patterns >= max_new_patterns) +- { +- max_new_patterns += 1; +- new_save_patterns = (char **) +- xrealloc ((char *) new_save_patterns, +- max_new_patterns * sizeof (char *)); +- } +- new_save_patterns[new_num_patterns] = xstrdup (pattern_name.ds_string); +- ++new_num_patterns; +- } +- if (ferror (pattern_fp) || fclose (pattern_fp) == EOF) +- close_error (pattern_file_name); ++ else ++ { ++ while (ds_fgetstr (pattern_fp, &pattern_name, '\n') != NULL) ++ { ++ if (new_num_patterns >= max_new_patterns) ++ { ++ max_new_patterns += 1; ++ new_save_patterns = (char **) ++ xrealloc ((char *) new_save_patterns, ++ max_new_patterns * sizeof (char *)); ++ } ++ new_save_patterns[new_num_patterns] = xstrdup (pattern_name.ds_string); ++ ++new_num_patterns; ++ } ++ if (ferror (pattern_fp) || fclose (pattern_fp) == EOF) ++ close_error (pattern_file_name); ++ } + + for (i = 0; i < num_patterns; ++i) + new_save_patterns[i] = save_patterns[i]; diff --git a/cpio.spec b/cpio.spec index e1d7df2..d314491 100644 --- a/cpio.spec +++ b/cpio.spec @@ -3,7 +3,7 @@ Summary: A GNU archiving program Name: cpio Version: 2.9.90 -Release: 6%{?dist} +Release: 7%{?dist} License: GPLv3+ Group: Applications/Archiving URL: http://www.gnu.org/software/cpio/ @@ -19,6 +19,7 @@ Patch6: cpio-2.9-dev_number.patch Patch7: cpio-2.9-sys_umask.patch Patch8: cpio-2.9.90-defaultremoteshell.patch Patch9: cpio-fortifysources.patch +Patch10: cpio-2.10-patternnamesigsegv.patch Requires(post): /sbin/install-info Requires(preun): /sbin/install-info BuildRequires: texinfo, autoconf, gettext, rmt @@ -49,6 +50,7 @@ Install cpio if you need a program to manage file archives. %patch7 -p1 -b .sys_umask %patch8 -p1 -b .defaultremote %patch9 -p1 -b .fortify +%patch10 -p1 -b .patternsegv autoheader @@ -74,11 +76,15 @@ install -c -p -m 0644 %{SOURCE1} ${RPM_BUILD_ROOT}%{_mandir}/man1 rm -rf ${RPM_BUILD_ROOT} %post -/sbin/install-info %{_infodir}/cpio.info.gz %{_infodir}/dir || : +if [ $1 = 0 ]; then + /sbin/install-info %{_infodir}/cpio.info.gz %{_infodir}/dir || : +fi %preun if [ $1 = 0 ]; then - /sbin/install-info --delete %{_infodir}/cpio.info.gz %{_infodir}/dir || : + if [ -f %{_infodir}/cpio.info.gz ]; then + /sbin/install-info --delete %{_infodir}/cpio.info.gz %{_infodir}/dir || : + fi fi %files -f %{name}.lang @@ -89,6 +95,11 @@ fi %{_infodir}/*.info* %changelog +* Thu Feb 25 2010 Ondrej Vasik 2.9.90-7 +- fix segfault with nonexisting file with patternnames + (#567022) +- do process install-info only without --excludedocs(#515924) + * Tue Dec 1 2009 Ondrej Vasik 2.9.90-6 - fix buffer overflow detection by fortify sources (#542389)