mirror of
https://git.yoctoproject.org/poky
synced 2026-04-26 18:32:13 +02:00
* CVE detail: https://nvd.nist.gov/vuln/detail/CVE-2018-1000156 * upstream tracking: https://savannah.gnu.org/bugs/index.php?53566 * Fix arbitrary command execution in ed-style patches: - src/pch.c (do_ed_script): Write ed script to a temporary file instead of piping it to ed: this will cause ed to abort on invalid commands instead of rejecting them and carrying on. - tests/ed-style: New test case. - tests/Makefile.am (TESTS): Add test case. (From OE-Core rev: 6b6ae212837a07aaefd2b675b5b527fbce2a4270) Signed-off-by: Jackie Huang <jackie.huang@windriver.com> Signed-off-by: Ross Burton <ross.burton@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
39 lines
1.2 KiB
Diff
39 lines
1.2 KiB
Diff
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.
|
|
|
|
Upstream-Status: Backport [http://git.savannah.gnu.org/cgit/patch.git/commit/?id=b5a91a01e5d0897facdd0f49d64b76b0f02b43e1]
|
|
CVE: CVE-2018-1000156
|
|
|
|
Signed-off-by: Jackie Huang <jackie.huang@windriver.com>
|
|
---
|
|
src/pch.c | 8 +++++---
|
|
1 file changed, 5 insertions(+), 3 deletions(-)
|
|
|
|
diff --git a/src/pch.c b/src/pch.c
|
|
index bc6278c..0c5cc26 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.7.4
|
|
|