From fe471a96dba6efb4467ea0f49a5b9279571376ab Mon Sep 17 00:00:00 2001 From: Tim Waugh Date: Fri, 23 Jan 2015 11:39:40 +0000 Subject: [PATCH] 2.7.3 (bug #1182157, CVE-2015-1196, bug #1184491, CVE-2014-9637). Resolves: rhbz#1182157 rhbz#1184491 --- .gitignore | 1 + patch-2.7.2.tar.xz.sig | 17 --------- patch-2.7.3.tar.xz.sig | 17 +++++++++ patch-selinux.patch | 83 +++++++++++++++++++++--------------------- patch.spec | 6 +-- sources | 2 +- 6 files changed, 64 insertions(+), 62 deletions(-) delete mode 100644 patch-2.7.2.tar.xz.sig create mode 100644 patch-2.7.3.tar.xz.sig diff --git a/.gitignore b/.gitignore index afc686b..5a61b54 100644 --- a/.gitignore +++ b/.gitignore @@ -4,3 +4,4 @@ patch-2.6.1.tar.xz /patch-2.7.tar.xz /patch-2.7.1.tar.xz /patch-2.7.2.tar.xz +/patch-2.7.3.tar.xz diff --git a/patch-2.7.2.tar.xz.sig b/patch-2.7.2.tar.xz.sig deleted file mode 100644 index 0a8c50d..0000000 --- a/patch-2.7.2.tar.xz.sig +++ /dev/null @@ -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----- diff --git a/patch-2.7.3.tar.xz.sig b/patch-2.7.3.tar.xz.sig new file mode 100644 index 0000000..0e6b530 --- /dev/null +++ b/patch-2.7.3.tar.xz.sig @@ -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----- diff --git a/patch-selinux.patch b/patch-selinux.patch index c65096b..843bc1f 100644 --- a/patch-selinux.patch +++ b/patch-selinux.patch @@ -1,6 +1,6 @@ -diff -up patch-2.7.2/src/common.h.selinux patch-2.7.2/src/common.h ---- patch-2.7.2/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 +diff -up patch-2.7.3/src/common.h.selinux patch-2.7.3/src/common.h +--- patch-2.7.3/src/common.h.selinux 2015-01-19 17:24:29.000000000 +0000 ++++ patch-2.7.3/src/common.h 2015-01-23 10:11:26.690195912 +0000 @@ -30,6 +30,8 @@ #include #include @@ -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 posixly_correct; -diff -up patch-2.7.2/src/inp.c.selinux patch-2.7.2/src/inp.c ---- patch-2.7.2/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 +diff -up patch-2.7.3/src/inp.c.selinux patch-2.7.3/src/inp.c +--- patch-2.7.3/src/inp.c.selinux 2014-11-26 13:17:55.000000000 +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 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)) && (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 ---- patch-2.7.2/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 +diff -up patch-2.7.3/src/Makefile.am.selinux patch-2.7.3/src/Makefile.am +--- patch-2.7.3/src/Makefile.am.selinux 2014-11-26 13:17:55.000000000 +0000 ++++ patch-2.7.3/src/Makefile.am 2015-01-23 10:11:26.738196109 +0000 @@ -34,7 +34,7 @@ patch_SOURCES = \ 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 patch_SOURCES += merge.c -diff -up patch-2.7.2/src/Makefile.in.selinux patch-2.7.2/src/Makefile.in ---- patch-2.7.2/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 +diff -up patch-2.7.3/src/Makefile.in.selinux patch-2.7.3/src/Makefile.in +--- patch-2.7.3/src/Makefile.in.selinux 2015-01-19 19:36:16.000000000 +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 AM_CPPFLAGS = -I$(top_builddir)/lib -I$(top_srcdir)/lib \ $(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 -diff -up patch-2.7.2/src/patch.c.selinux patch-2.7.2/src/patch.c ---- patch-2.7.2/src/patch.c.selinux 2015-01-20 09:11:48.000000000 +0000 -+++ patch-2.7.2/src/patch.c 2015-01-21 15:17:16.278750796 +0000 -@@ -257,19 +257,19 @@ main (int argc, char **argv) +diff -up patch-2.7.3/src/patch.c.selinux patch-2.7.3/src/patch.c +--- patch-2.7.3/src/patch.c.selinux 2015-01-21 15:32:41.000000000 +0000 ++++ patch-2.7.3/src/patch.c 2015-01-23 10:11:26.739196113 +0000 +@@ -260,19 +260,19 @@ main (int argc, char **argv) if (! strcmp (inname, outname)) { 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; } if (! outerrno) -@@ -564,7 +564,7 @@ main (int argc, char **argv) +@@ -567,7 +567,7 @@ main (int argc, char **argv) mode, &new_time); 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, mode, &new_time); } -@@ -624,7 +624,7 @@ main (int argc, char **argv) +@@ -627,7 +627,7 @@ main (int argc, char **argv) struct stat oldst; 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) write_fatal (); 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) { @@ -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); st = &st_tmp; } -diff -up patch-2.7.2/src/pch.c.selinux patch-2.7.2/src/pch.c ---- patch-2.7.2/src/pch.c.selinux 2015-01-20 11:43:07.000000000 +0000 -+++ patch-2.7.2/src/pch.c 2015-01-21 15:18:00.130926862 +0000 +diff -up patch-2.7.3/src/pch.c.selinux patch-2.7.3/src/pch.c +--- patch-2.7.3/src/pch.c.selinux 2015-01-22 20:23:31.000000000 +0000 ++++ patch-2.7.3/src/pch.c 2015-01-23 10:11:26.740196117 +0000 @@ -1,6 +1,6 @@ /* 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) { 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; enum nametype i; 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 version_controlled[3]; 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[NEW] = -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_timestamp[OLD].tv_sec = p_timestamp[NEW].tv_sec = -1; 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 { @@ -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 (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 (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; else 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) { @@ -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) 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]; invc = version_controlled[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; } -diff -up patch-2.7.2/src/util.c.selinux patch-2.7.2/src/util.c ---- patch-2.7.2/src/util.c.selinux 2015-01-20 09:08:38.000000000 +0000 -+++ patch-2.7.2/src/util.c 2015-01-21 15:17:16.279750800 +0000 +diff -up patch-2.7.3/src/util.c.selinux patch-2.7.3/src/util.c +--- patch-2.7.3/src/util.c.selinux 2015-01-22 20:39:08.000000000 +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 S_ISLNK (mode) ? "symbolic link" : "file", 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 -@@ -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; 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) create_backup (to, to_errno ? NULL : &to_st, false); 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. */ bool 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) { -@@ -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); if (stat (filename, filestat) != 0) 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; -@@ -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; } - /* Check if we are in the root of a particular filesystem namespace ("/" on -diff -up patch-2.7.2/src/util.h.selinux patch-2.7.2/src/util.h ---- patch-2.7.2/src/util.h.selinux 2015-01-20 09:07:24.000000000 +0000 -+++ patch-2.7.2/src/util.h 2015-01-21 15:17:16.280750804 +0000 + /* Check if a filename is relative and free of ".." components. +diff -up patch-2.7.3/src/util.h.selinux patch-2.7.3/src/util.h +--- patch-2.7.3/src/util.h.selinux 2015-01-22 20:30:47.000000000 +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 char *savebuf (char const *, size_t); 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 systemic (char const *); 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 *); void set_queued_output (struct stat const *, bool); bool has_queued_output (struct stat const *); -int stat_file (char const *, struct stat *); +int stat_file (char const *, struct stat *, security_context_t *); + bool filename_is_safe (char const *); bool cwd_is_root (char const *); - enum file_attributes { +@@ -76,7 +76,8 @@ enum file_attributes { FA_TIMES = 1, FA_IDS = 2, FA_MODE = 4, diff --git a/patch.spec b/patch.spec index 8700f9e..5466015 100644 --- a/patch.spec +++ b/patch.spec @@ -1,6 +1,6 @@ Summary: Utility for modifying/upgrading files Name: patch -Version: 2.7.2 +Version: 2.7.3 Release: 1%{?dist} License: GPLv3+ URL: http://www.gnu.org/software/patch/patch.html @@ -54,8 +54,8 @@ rm -rf $RPM_BUILD_ROOT %{_mandir}/*/* %changelog -* Fri Jan 23 2015 Tim Waugh - 2.7.2-1 -- 2.7.2. +* Fri Jan 23 2015 Tim Waugh - 2.7.3-1 +- 2.7.3 (bug #1182157, CVE-2015-1196, bug #1184491, CVE-2014-9637). * Tue Jan 20 2015 Tim Waugh - 2.7.1-12 - Apply upstream patch to fix line numbering integer overflow. diff --git a/sources b/sources index 9e3e560..8d1ed20 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -0b0217d45d3d45d3f07d6b241abbeb2a patch-2.7.2.tar.xz +29b87be845e4662ab0ca0d48a805ecc6 patch-2.7.3.tar.xz