2.7.3 (bug #1182157, CVE-2015-1196, bug #1184491, CVE-2014-9637).

Resolves: rhbz#1182157 rhbz#1184491
This commit is contained in:
Tim Waugh 2015-01-23 11:39:40 +00:00
parent 5587b741e0
commit fe471a96db
6 changed files with 64 additions and 62 deletions

1
.gitignore vendored
View File

@ -4,3 +4,4 @@ patch-2.6.1.tar.xz
/patch-2.7.tar.xz /patch-2.7.tar.xz
/patch-2.7.1.tar.xz /patch-2.7.1.tar.xz
/patch-2.7.2.tar.xz /patch-2.7.2.tar.xz
/patch-2.7.3.tar.xz

View File

@ -1,17 +0,0 @@
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1
iQIcBAABAgAGBQJUvuVFAAoJEMTJJ81dGzbX6mcP/RTbggN+E0KdDpsTRyIJmSM/
Wqql+SYMZlrXNqC9fpflfXodwumnztJcZxIubHfZiiJM1AeWTL3c7qWmlGXz7/og
CFLv6nKQQ26p45FthtCRRlYkTLymoMcVjju+C7WoxheZe6oy5kD6KeDXfQKvy9mc
09EbCt3OlKwztk/toRnk+Zwj9l3GtfhqPCqIO7vmT/KyV1lErWHVGvKw8Ecrb4jg
YcMJ3ttXschvkZWDmJibnBdJOFd5qFWjpOqbcmLkEeDDnKaIQ0YRwOdfDi761aPO
h1XZkt2cbFsAAmGegFFxPOxQjBX9hmJZ9tl/x1ka/iSBBEAljqvLWh11E5ZToUtS
QGD9t7uDFEyVKNpkSkiqsgGh5U4eyOxbsni22ZWtjeHWlIwoamEEp77211/FlROF
V1nZvuF12p+HyRKOl4UV3/EHUlWTXhzbLyRPNeQFBUcXk+KPrk9K2yicQmSDa+qF
Y4zNFE7Cs8AVh18CzzILXj31FS1sNp8BxUq3tEGz5DOrS/McvQvoYS4FWT/SzVOp
q8g3PzgC5G1suA3Lp8DK9okYOttHpU1ZUlldg11Q5FPjoRZVyhdaBRUko3GFxMWs
5/EMvIFNz2X5vUD6Bl+ggWd8yYdTYngBMxB0KRukgaO/sjKffjww83l3knpapimm
02+0Xdc/j2e9gE1xDvMR
=Y3Lt
-----END PGP SIGNATURE-----

17
patch-2.7.3.tar.xz.sig Normal file
View File

@ -0,0 +1,17 @@
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1
iQIcBAABAgAGBQJUwWX8AAoJEMTJJ81dGzbXivMP/04QBTz249nmpzyFkjbZqTyw
IIvj30iNuRJLbvJb2EwPDWoUPG+IPH3n/zzF1ir0zvV/NUCBt6kGUrJ7jOx/EqNl
dZ+W7jycUos89B2XoPBZ5wL12ucj1OMD7bEMyiU2VNY3T5/0CbkBLtN9CbBcVk+K
rUwSEx8RSgWGj3zdoqagwfEjiWj/w0XHQP1c4Mt8FO6z3MHZTVeLlZtokcbrffGe
Jj9Jl4KvJNrluyHE23wt+CSR+oa6ocBmXjj1Mh/WMKYyjSM4tizSbFmd+MRiRvkj
MU4DI3IAQHxx/pTQVNykONmy9o3dbHzv+Z1NJLXPn39Z0OJdyL8ib9JgAate+Raf
M1LpT9oF2SNMhbS8MPY2cNv1COg86+iCEQcwupofvVfggs2woh7lKZxJmBQ+HMeb
xfVFebDyVpMYI5wyehIFu05ZbLqHKxgTkaAMch2NCzQK/t1pHcrSmYDaUxgsP8GE
rTetI6eTYsHHgRiJDzmXg82UDtVP+1IoxUfLTUzU7r4bftxYaexcKEJSJ2q1kiBd
Go1x1eg2lgndKy5+U5LnlG7SnsO6XbKPkxpIjV/4ndIZgKLftIsC1vRDNOVfJBBt
IuWvlHpChIzeq7Ny/QTmpDL54eLNOyQu1v7JgisEOQkiFwH15pqUrBf9hdGvzqJ9
1oRiLPhsxkF9F4DDt4ZU
=kKpc
-----END PGP SIGNATURE-----

View File

@ -1,6 +1,6 @@
diff -up patch-2.7.2/src/common.h.selinux patch-2.7.2/src/common.h diff -up patch-2.7.3/src/common.h.selinux patch-2.7.3/src/common.h
--- patch-2.7.2/src/common.h.selinux 2015-01-19 17:24:29.000000000 +0000 --- patch-2.7.3/src/common.h.selinux 2015-01-19 17:24:29.000000000 +0000
+++ patch-2.7.2/src/common.h 2015-01-21 15:17:16.267750752 +0000 +++ patch-2.7.3/src/common.h 2015-01-23 10:11:26.690195912 +0000
@@ -30,6 +30,8 @@ @@ -30,6 +30,8 @@
#include <sys/types.h> #include <sys/types.h>
#include <time.h> #include <time.h>
@ -18,9 +18,9 @@ diff -up patch-2.7.2/src/common.h.selinux patch-2.7.2/src/common.h
XTERN bool dry_run; XTERN bool dry_run;
XTERN bool posixly_correct; XTERN bool posixly_correct;
diff -up patch-2.7.2/src/inp.c.selinux patch-2.7.2/src/inp.c diff -up patch-2.7.3/src/inp.c.selinux patch-2.7.3/src/inp.c
--- patch-2.7.2/src/inp.c.selinux 2014-11-26 13:17:55.000000000 +0000 --- patch-2.7.3/src/inp.c.selinux 2014-11-26 13:17:55.000000000 +0000
+++ patch-2.7.2/src/inp.c 2015-01-21 15:17:16.277750792 +0000 +++ patch-2.7.3/src/inp.c 2015-01-23 10:11:26.738196109 +0000
@@ -144,7 +144,7 @@ get_input_file (char const *filename, ch @@ -144,7 +144,7 @@ get_input_file (char const *filename, ch
char *getbuf; char *getbuf;
@ -47,9 +47,9 @@ diff -up patch-2.7.2/src/inp.c.selinux patch-2.7.2/src/inp.c
} }
else if (! ((S_ISREG (file_type) || S_ISLNK (file_type)) else if (! ((S_ISREG (file_type) || S_ISLNK (file_type))
&& (file_type & S_IFMT) == (instat.st_mode & S_IFMT))) && (file_type & S_IFMT) == (instat.st_mode & S_IFMT)))
diff -up patch-2.7.2/src/Makefile.am.selinux patch-2.7.2/src/Makefile.am diff -up patch-2.7.3/src/Makefile.am.selinux patch-2.7.3/src/Makefile.am
--- patch-2.7.2/src/Makefile.am.selinux 2014-11-26 13:17:55.000000000 +0000 --- patch-2.7.3/src/Makefile.am.selinux 2014-11-26 13:17:55.000000000 +0000
+++ patch-2.7.2/src/Makefile.am 2015-01-21 15:17:16.278750796 +0000 +++ patch-2.7.3/src/Makefile.am 2015-01-23 10:11:26.738196109 +0000
@@ -34,7 +34,7 @@ patch_SOURCES = \ @@ -34,7 +34,7 @@ patch_SOURCES = \
AM_CPPFLAGS = -I$(top_builddir)/lib -I$(top_srcdir)/lib AM_CPPFLAGS = -I$(top_builddir)/lib -I$(top_srcdir)/lib
@ -59,9 +59,9 @@ diff -up patch-2.7.2/src/Makefile.am.selinux patch-2.7.2/src/Makefile.am
if ENABLE_MERGE if ENABLE_MERGE
patch_SOURCES += merge.c patch_SOURCES += merge.c
diff -up patch-2.7.2/src/Makefile.in.selinux patch-2.7.2/src/Makefile.in diff -up patch-2.7.3/src/Makefile.in.selinux patch-2.7.3/src/Makefile.in
--- patch-2.7.2/src/Makefile.in.selinux 2015-01-19 19:36:16.000000000 +0000 --- patch-2.7.3/src/Makefile.in.selinux 2015-01-19 19:36:16.000000000 +0000
+++ patch-2.7.2/src/Makefile.in 2015-01-21 15:17:16.278750796 +0000 +++ patch-2.7.3/src/Makefile.in 2015-01-23 10:11:26.738196109 +0000
@@ -1047,7 +1047,7 @@ patch_SOURCES = bestmatch.h common.h inp @@ -1047,7 +1047,7 @@ patch_SOURCES = bestmatch.h common.h inp
AM_CPPFLAGS = -I$(top_builddir)/lib -I$(top_srcdir)/lib \ AM_CPPFLAGS = -I$(top_builddir)/lib -I$(top_srcdir)/lib \
$(am__append_2) $(am__append_2)
@ -71,10 +71,10 @@ diff -up patch-2.7.2/src/Makefile.in.selinux patch-2.7.2/src/Makefile.in
all: all-am all: all-am
diff -up patch-2.7.2/src/patch.c.selinux patch-2.7.2/src/patch.c diff -up patch-2.7.3/src/patch.c.selinux patch-2.7.3/src/patch.c
--- patch-2.7.2/src/patch.c.selinux 2015-01-20 09:11:48.000000000 +0000 --- patch-2.7.3/src/patch.c.selinux 2015-01-21 15:32:41.000000000 +0000
+++ patch-2.7.2/src/patch.c 2015-01-21 15:17:16.278750796 +0000 +++ patch-2.7.3/src/patch.c 2015-01-23 10:11:26.739196113 +0000
@@ -257,19 +257,19 @@ main (int argc, char **argv) @@ -260,19 +260,19 @@ main (int argc, char **argv)
if (! strcmp (inname, outname)) if (! strcmp (inname, outname))
{ {
if (inerrno == -1) if (inerrno == -1)
@ -97,7 +97,7 @@ diff -up patch-2.7.2/src/patch.c.selinux patch-2.7.2/src/patch.c
inerrno = -1; inerrno = -1;
} }
if (! outerrno) if (! outerrno)
@@ -564,7 +564,7 @@ main (int argc, char **argv) @@ -567,7 +567,7 @@ main (int argc, char **argv)
mode, &new_time); mode, &new_time);
else else
{ {
@ -106,7 +106,7 @@ diff -up patch-2.7.2/src/patch.c.selinux patch-2.7.2/src/patch.c
set_file_attributes (TMPOUTNAME, attr, inname, &instat, set_file_attributes (TMPOUTNAME, attr, inname, &instat,
mode, &new_time); mode, &new_time);
} }
@@ -624,7 +624,7 @@ main (int argc, char **argv) @@ -627,7 +627,7 @@ main (int argc, char **argv)
struct stat oldst; struct stat oldst;
int olderrno; int olderrno;
@ -115,7 +115,7 @@ diff -up patch-2.7.2/src/patch.c.selinux patch-2.7.2/src/patch.c
if (olderrno && olderrno != ENOENT) if (olderrno && olderrno != ENOENT)
write_fatal (); write_fatal ();
if (! olderrno && lookup_file_id (&oldst) == CREATED) if (! olderrno && lookup_file_id (&oldst) == CREATED)
@@ -1754,7 +1754,7 @@ delete_file_later (const char *name, con @@ -1757,7 +1757,7 @@ delete_file_later (const char *name, con
if (! st) if (! st)
{ {
@ -124,9 +124,9 @@ diff -up patch-2.7.2/src/patch.c.selinux patch-2.7.2/src/patch.c
pfatal ("Can't get file attributes of %s %s", "file", name); pfatal ("Can't get file attributes of %s %s", "file", name);
st = &st_tmp; st = &st_tmp;
} }
diff -up patch-2.7.2/src/pch.c.selinux patch-2.7.2/src/pch.c diff -up patch-2.7.3/src/pch.c.selinux patch-2.7.3/src/pch.c
--- patch-2.7.2/src/pch.c.selinux 2015-01-20 11:43:07.000000000 +0000 --- patch-2.7.3/src/pch.c.selinux 2015-01-22 20:23:31.000000000 +0000
+++ patch-2.7.2/src/pch.c 2015-01-21 15:18:00.130926862 +0000 +++ patch-2.7.3/src/pch.c 2015-01-23 10:11:26.740196117 +0000
@@ -1,6 +1,6 @@ @@ -1,6 +1,6 @@
/* reading patches */ /* reading patches */
@ -144,7 +144,7 @@ diff -up patch-2.7.2/src/pch.c.selinux patch-2.7.2/src/pch.c
if (inerrno) if (inerrno)
{ {
perror (inname); perror (inname);
@@ -444,6 +444,7 @@ intuit_diff_type (bool need_header, mode @@ -430,6 +430,7 @@ intuit_diff_type (bool need_header, mode
bool extended_headers = false; bool extended_headers = false;
enum nametype i; enum nametype i;
struct stat st[3]; struct stat st[3];
@ -152,7 +152,7 @@ diff -up patch-2.7.2/src/pch.c.selinux patch-2.7.2/src/pch.c
int stat_errno[3]; int stat_errno[3];
int version_controlled[3]; int version_controlled[3];
enum diff retval; enum diff retval;
@@ -483,6 +484,7 @@ intuit_diff_type (bool need_header, mode @@ -469,6 +470,7 @@ intuit_diff_type (bool need_header, mode
version_controlled[OLD] = -1; version_controlled[OLD] = -1;
version_controlled[NEW] = -1; version_controlled[NEW] = -1;
version_controlled[INDEX] = -1; version_controlled[INDEX] = -1;
@ -160,7 +160,7 @@ diff -up patch-2.7.2/src/pch.c.selinux patch-2.7.2/src/pch.c
p_rfc934_nesting = 0; p_rfc934_nesting = 0;
p_timestamp[OLD].tv_sec = p_timestamp[NEW].tv_sec = -1; p_timestamp[OLD].tv_sec = p_timestamp[NEW].tv_sec = -1;
p_says_nonexistent[OLD] = p_says_nonexistent[NEW] = 0; p_says_nonexistent[OLD] = p_says_nonexistent[NEW] = 0;
@@ -890,7 +892,7 @@ intuit_diff_type (bool need_header, mode @@ -876,7 +878,7 @@ intuit_diff_type (bool need_header, mode
} }
else else
{ {
@ -169,7 +169,7 @@ diff -up patch-2.7.2/src/pch.c.selinux patch-2.7.2/src/pch.c
if (! stat_errno[i]) if (! stat_errno[i])
{ {
if (lookup_file_id (&st[i]) == DELETE_LATER) if (lookup_file_id (&st[i]) == DELETE_LATER)
@@ -929,7 +931,7 @@ intuit_diff_type (bool need_header, mode @@ -915,7 +917,7 @@ intuit_diff_type (bool need_header, mode
if (cs) if (cs)
{ {
if (version_get (p_name[i], cs, false, readonly, if (version_get (p_name[i], cs, false, readonly,
@ -178,7 +178,7 @@ diff -up patch-2.7.2/src/pch.c.selinux patch-2.7.2/src/pch.c
stat_errno[i] = 0; stat_errno[i] = 0;
else else
version_controlled[i] = 0; version_controlled[i] = 0;
@@ -982,7 +984,7 @@ intuit_diff_type (bool need_header, mode @@ -978,7 +980,7 @@ intuit_diff_type (bool need_header, mode
{ {
if (inname) if (inname)
{ {
@ -187,7 +187,7 @@ diff -up patch-2.7.2/src/pch.c.selinux patch-2.7.2/src/pch.c
if (inerrno || (instat.st_mode & S_IFMT) == file_type) if (inerrno || (instat.st_mode & S_IFMT) == file_type)
maybe_reverse (inname, inerrno, inerrno || instat.st_size == 0); maybe_reverse (inname, inerrno, inerrno || instat.st_size == 0);
} }
@@ -995,8 +997,14 @@ intuit_diff_type (bool need_header, mode @@ -991,8 +993,14 @@ intuit_diff_type (bool need_header, mode
inerrno = stat_errno[i]; inerrno = stat_errno[i];
invc = version_controlled[i]; invc = version_controlled[i];
instat = st[i]; instat = st[i];
@ -202,9 +202,9 @@ diff -up patch-2.7.2/src/pch.c.selinux patch-2.7.2/src/pch.c
return retval; return retval;
} }
diff -up patch-2.7.2/src/util.c.selinux patch-2.7.2/src/util.c diff -up patch-2.7.3/src/util.c.selinux patch-2.7.3/src/util.c
--- patch-2.7.2/src/util.c.selinux 2015-01-20 09:08:38.000000000 +0000 --- patch-2.7.3/src/util.c.selinux 2015-01-22 20:39:08.000000000 +0000
+++ patch-2.7.2/src/util.c 2015-01-21 15:17:16.279750800 +0000 +++ patch-2.7.3/src/util.c 2015-01-23 11:01:12.859170158 +0000
@@ -295,6 +295,19 @@ set_file_attributes (char const *to, enu @@ -295,6 +295,19 @@ set_file_attributes (char const *to, enu
S_ISLNK (mode) ? "symbolic link" : "file", S_ISLNK (mode) ? "symbolic link" : "file",
quotearg (to)); quotearg (to));
@ -225,7 +225,7 @@ diff -up patch-2.7.2/src/util.c.selinux patch-2.7.2/src/util.c
} }
static void static void
@@ -495,7 +508,7 @@ move_file (char const *from, bool *from_ @@ -458,7 +471,7 @@ move_file (char const *from, bool *from_
struct stat to_st; struct stat to_st;
int to_errno; int to_errno;
@ -234,7 +234,7 @@ diff -up patch-2.7.2/src/util.c.selinux patch-2.7.2/src/util.c
if (backup) if (backup)
create_backup (to, to_errno ? NULL : &to_st, false); create_backup (to, to_errno ? NULL : &to_st, false);
if (! to_errno) if (! to_errno)
@@ -872,7 +885,8 @@ version_controller (char const *filename @@ -839,7 +852,8 @@ version_controller (char const *filename
Return true if successful. */ Return true if successful. */
bool bool
version_get (char const *filename, char const *cs, bool exists, bool readonly, version_get (char const *filename, char const *cs, bool exists, bool readonly,
@ -244,7 +244,7 @@ diff -up patch-2.7.2/src/util.c.selinux patch-2.7.2/src/util.c
{ {
if (patch_get < 0) if (patch_get < 0)
{ {
@@ -897,6 +911,13 @@ version_get (char const *filename, char @@ -864,6 +878,13 @@ version_get (char const *filename, char
fatal ("Can't get file %s from %s", quotearg (filename), cs); fatal ("Can't get file %s from %s", quotearg (filename), cs);
if (stat (filename, filestat) != 0) if (stat (filename, filestat) != 0)
pfatal ("%s", quotearg (filename)); pfatal ("%s", quotearg (filename));
@ -258,7 +258,7 @@ diff -up patch-2.7.2/src/util.c.selinux patch-2.7.2/src/util.c
} }
return 1; return 1;
@@ -1712,12 +1733,28 @@ make_tempfile (char const **name, char l @@ -1679,12 +1700,28 @@ make_tempfile (char const **name, char l
} }
} }
@ -288,10 +288,10 @@ diff -up patch-2.7.2/src/util.c.selinux patch-2.7.2/src/util.c
+ return errno; + return errno;
} }
/* Check if we are in the root of a particular filesystem namespace ("/" on /* Check if a filename is relative and free of ".." components.
diff -up patch-2.7.2/src/util.h.selinux patch-2.7.2/src/util.h diff -up patch-2.7.3/src/util.h.selinux patch-2.7.3/src/util.h
--- patch-2.7.2/src/util.h.selinux 2015-01-20 09:07:24.000000000 +0000 --- patch-2.7.3/src/util.h.selinux 2015-01-22 20:30:47.000000000 +0000
+++ patch-2.7.2/src/util.h 2015-01-21 15:17:16.280750804 +0000 +++ patch-2.7.3/src/util.h 2015-01-23 11:01:49.689364744 +0000
@@ -45,7 +45,7 @@ char *parse_name (char const *, int, cha @@ -45,7 +45,7 @@ char *parse_name (char const *, int, cha
char *savebuf (char const *, size_t); char *savebuf (char const *, size_t);
char *savestr (char const *); char *savestr (char const *);
@ -301,15 +301,16 @@ diff -up patch-2.7.2/src/util.h.selinux patch-2.7.2/src/util.h
int create_file (char const *, int, mode_t, bool); int create_file (char const *, int, mode_t, bool);
int systemic (char const *); int systemic (char const *);
char *format_linenum (char[LINENUM_LENGTH_BOUND + 1], lin); char *format_linenum (char[LINENUM_LENGTH_BOUND + 1], lin);
@@ -68,14 +68,15 @@ void insert_file_id (struct stat const * @@ -68,7 +68,7 @@ void insert_file_id (struct stat const *
enum file_id_type lookup_file_id (struct stat const *); enum file_id_type lookup_file_id (struct stat const *);
void set_queued_output (struct stat const *, bool); void set_queued_output (struct stat const *, bool);
bool has_queued_output (struct stat const *); bool has_queued_output (struct stat const *);
-int stat_file (char const *, struct stat *); -int stat_file (char const *, struct stat *);
+int stat_file (char const *, struct stat *, security_context_t *); +int stat_file (char const *, struct stat *, security_context_t *);
bool filename_is_safe (char const *);
bool cwd_is_root (char const *); bool cwd_is_root (char const *);
enum file_attributes { @@ -76,7 +76,8 @@ enum file_attributes {
FA_TIMES = 1, FA_TIMES = 1,
FA_IDS = 2, FA_IDS = 2,
FA_MODE = 4, FA_MODE = 4,

View File

@ -1,6 +1,6 @@
Summary: Utility for modifying/upgrading files Summary: Utility for modifying/upgrading files
Name: patch Name: patch
Version: 2.7.2 Version: 2.7.3
Release: 1%{?dist} Release: 1%{?dist}
License: GPLv3+ License: GPLv3+
URL: http://www.gnu.org/software/patch/patch.html URL: http://www.gnu.org/software/patch/patch.html
@ -54,8 +54,8 @@ rm -rf $RPM_BUILD_ROOT
%{_mandir}/*/* %{_mandir}/*/*
%changelog %changelog
* Fri Jan 23 2015 Tim Waugh <twaugh@redhat.com> - 2.7.2-1 * Fri Jan 23 2015 Tim Waugh <twaugh@redhat.com> - 2.7.3-1
- 2.7.2. - 2.7.3 (bug #1182157, CVE-2015-1196, bug #1184491, CVE-2014-9637).
* Tue Jan 20 2015 Tim Waugh <twaugh@redhat.com> - 2.7.1-12 * Tue Jan 20 2015 Tim Waugh <twaugh@redhat.com> - 2.7.1-12
- Apply upstream patch to fix line numbering integer overflow. - Apply upstream patch to fix line numbering integer overflow.

View File

@ -1 +1 @@
0b0217d45d3d45d3f07d6b241abbeb2a patch-2.7.2.tar.xz 29b87be845e4662ab0ca0d48a805ecc6 patch-2.7.3.tar.xz