summaryrefslogtreecommitdiffstats
path: root/package/patch/0002-Allow-input-files-to-be-missing-for-ed-style-patches.patch
diff options
context:
space:
mode:
authorBaruch Siach <baruch@tkos.co.il>2018-04-09 19:20:36 +0300
committerThomas Petazzoni <thomas.petazzoni@bootlin.com>2018-04-09 20:59:02 +0200
commitf4a4df2084b923f29eca2130976ca10a7aa6b719 (patch)
tree61af17ff06c91879849ddbaad41b59c532e8b6c4 /package/patch/0002-Allow-input-files-to-be-missing-for-ed-style-patches.patch
parent265aee8c51718fe7370a3dbc91048ff60eb5909c (diff)
downloadbuildroot-f4a4df2084b923f29eca2130976ca10a7aa6b719.tar.gz
buildroot-f4a4df2084b923f29eca2130976ca10a7aa6b719.zip
patch: add upstream security fix
Fixes CVE-2018-1000156: arbitrary command execution in ed-style patches. Depend on MMU for now, because the patch adds a fork() call. Upstream later switched to gnulib provided execute(), so this dependency can be dropped on the next version bump. Signed-off-by: Baruch Siach <baruch@tkos.co.il> Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
Diffstat (limited to 'package/patch/0002-Allow-input-files-to-be-missing-for-ed-style-patches.patch')
-rw-r--r--package/patch/0002-Allow-input-files-to-be-missing-for-ed-style-patches.patch37
1 files changed, 37 insertions, 0 deletions
diff --git a/package/patch/0002-Allow-input-files-to-be-missing-for-ed-style-patches.patch b/package/patch/0002-Allow-input-files-to-be-missing-for-ed-style-patches.patch
new file mode 100644
index 0000000000..7d5757d1af
--- /dev/null
+++ b/package/patch/0002-Allow-input-files-to-be-missing-for-ed-style-patches.patch
@@ -0,0 +1,37 @@
+From b5a91a01e5d0897facdd0f49d64b76b0f02b43e1 Mon Sep 17 00:00:00 2001
+From: Andreas Gruenbacher <agruen@gnu.org>
+Date: Fri, 6 Apr 2018 11:34:51 +0200
+Subject: [PATCH] Allow input files to be missing for ed-style patches
+
+* src/pch.c (do_ed_script): Allow input files to be missing so that new
+files will be created as with non-ed-style patches.
+
+Signed-off-by: Baruch Siach <baruch@tkos.co.il>
+---
+Upstream status: commit b5a91a01e5d0
+
+ src/pch.c | 8 +++++---
+ 1 file changed, 5 insertions(+), 3 deletions(-)
+
+diff --git a/src/pch.c b/src/pch.c
+index bc6278c4032c..0c5cc2623079 100644
+--- a/src/pch.c
++++ b/src/pch.c
+@@ -2394,9 +2394,11 @@ do_ed_script (char const *inname, char const *outname,
+
+ if (! dry_run && ! skip_rest_of_patch) {
+ int exclusive = *outname_needs_removal ? 0 : O_EXCL;
+- assert (! inerrno);
+- *outname_needs_removal = true;
+- copy_file (inname, outname, 0, exclusive, instat.st_mode, true);
++ if (inerrno != ENOENT)
++ {
++ *outname_needs_removal = true;
++ copy_file (inname, outname, 0, exclusive, instat.st_mode, true);
++ }
+ sprintf (buf, "%s %s%s", editor_program,
+ verbosity == VERBOSE ? "" : "- ",
+ outname);
+--
+2.16.3
+
OpenPOWER on IntegriCloud