Don't segfault when given bad arguments (bug #972330).

Resolves: rhbz#972330
This commit is contained in:
Tim Waugh 2013-06-12 16:50:17 +01:00
parent cfe682fbc8
commit 04ed70767c
2 changed files with 28 additions and 1 deletions

20
patch-args-segfault.patch Normal file
View File

@ -0,0 +1,20 @@
diff -up patch-2.7.1/src/patch.c.args-segfault patch-2.7.1/src/patch.c
--- patch-2.7.1/src/patch.c.args-segfault 2013-06-12 16:48:50.617108731 +0100
+++ patch-2.7.1/src/patch.c 2013-06-12 16:49:06.790181916 +0100
@@ -150,6 +150,8 @@ main (int argc, char **argv)
else if ((version_control = getenv ("VERSION_CONTROL")))
version_control_context = "$VERSION_CONTROL";
+ init_files_to_output ();
+
/* parse switches */
Argc = argc;
Argv = argv;
@@ -164,7 +166,6 @@ main (int argc, char **argv)
init_backup_hash_table ();
init_files_to_delete ();
- init_files_to_output ();
init_output (&outstate);
if (outfile)

View File

@ -1,13 +1,14 @@
Summary: Utility for modifying/upgrading files
Name: patch
Version: 2.7.1
Release: 5%{?dist}
Release: 6%{?dist}
License: GPLv3+
URL: http://www.gnu.org/software/patch/patch.html
Group: Development/Tools
Source: ftp://ftp.gnu.org/gnu/patch/patch-%{version}.tar.xz
Patch1: patch-remove-empty-dir.patch
Patch2: patch-args.patch
Patch3: patch-args-segfault.patch
Patch100: patch-selinux.patch
Buildroot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
@ -34,6 +35,9 @@ applications.
# Don't document unsupported -m option; document -x option (bug #948972).
%patch2 -p1 -b .args
# Don't segfault when given bad arguments (bug #972330).
%patch3 -p1 -b .args-segfault
# SELinux support.
%patch100 -p1 -b .selinux
@ -62,6 +66,9 @@ rm -rf $RPM_BUILD_ROOT
%{_mandir}/*/*
%changelog
* Wed Jun 12 2013 Tim Waugh <twaugh@redhat.com> 2.7.1-6
- Don't segfault when given bad arguments (bug #972330).
* Thu Apr 11 2013 Tim Waugh <twaugh@redhat.com> 2.7.1-5
- Don't document unsupported -m option; document -x option (bug #948972).