patch: fix CVE-2018-6951 and CVE-2018-1000156
cover patch: fix CVE-2018-6951 and CVE-2018-1000156
From: Jackie Huang <[email protected]>
These are also needed for previous releases, so I think they should be backported to the branch for 2.5 and 2.4 as well.
--
The following changes since commit 29f65bda6d2c9fea4adb125c4857ee64f9312b9f:
nativesdk-glibc: Split glibc and libcrypt to use libxcrypt instead (2018-04-07 22:34:45 +0100)
are available in the git repository at:
git://git.pokylinux.org/poky-contrib.git jhuang0/d_patch_CVEs_180411_0
http://git.pokylinux.org/cgit.cgi//log/?h=jhuang0/d_patch_CVEs_180411_0
Jackie Huang (2):
patch: fix CVE-2018-6951
patch: fix CVE-2018-1000156
...02-Fix-segfault-with-mangled-rename-patch.patch | 35 ++++ ...-files-to-be-missing-for-ed-style-patches.patch | 38 ++++ ...ry-command-execution-in-ed-style-patches-.patch | 215 +++++++++++++++++++++ meta/recipes-devtools/patch/patch_2.7.6.bb | 6 +- 4 files changed, 293 insertions(+), 1 deletion(-) create mode 100644 meta/recipes-devtools/patch/patch/0002-Fix-segfault-with-mangled-rename-patch.patch create mode 100644 meta/recipes-devtools/patch/patch/0003-Allow-input-files-to-be-missing-for-ed-style-patches.patch create mode 100644 meta/recipes-devtools/patch/patch/0004-Fix-arbitrary-command-execution-in-ed-style-patches-.patch
Signature · 1 line
2.11.0
PATCH 1/2 patch: fix CVE-2018-6951
From: Jackie Huang <[email protected]>
* CVE detail: https://nvd.nist.gov/vuln/detail/CVE-2018-6951
* upstream tracking: http://savannah.gnu.org/bugs/?53132
* Fix segfault with mangled rename patch
- src/pch.c (intuit_diff_type): Ensure that two filenames are specified for renames and copies (fix the existing check).
--- ...02-Fix-segfault-with-mangled-rename-patch.patch | 35 ++++++++++++++++++++++ meta/recipes-devtools/patch/patch_2.7.6.bb | 4 ++- 2 files changed, 38 insertions(+), 1 deletion(-) create mode 100644 meta/recipes-devtools/patch/patch/0002-Fix-segfault-with-mangled-rename-patch.patch
meta/recipes-devtools/patch/patch/0002-Fix-segfault-with-mangled-rename-patch.patch new file +35 -0
@@ -0,0 +1,35 @@ +From f290f48a621867084884bfff87f8093c15195e6a Mon Sep 17 00:00:00 2001 +From: Andreas Gruenbacher <[email protected]> +Date: Mon, 12 Feb 2018 16:48:24 +0100 +Subject: [PATCH] Fix segfault with mangled rename patch + +http://savannah.gnu.org/bugs/?53132 +* src/pch.c (intuit_diff_type): Ensure that two filenames are specified +for renames and copies (fix the existing check). + +Upstream-Status: Backport [http://git.savannah.gnu.org/cgit/patch.git/commit/?id=f290f48a621867084884bfff87f8093c15195e6a] +CVE: CVE-2018-6951 + +Signed-off-by: Jackie Huang <[email protected]> + +--- + src/pch.c | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/src/pch.c b/src/pch.c +index ff9ed2c..bc6278c 100644 +--- a/src/pch.c ++++ b/src/pch.c +@@ -974,7 +974,8 @@ intuit_diff_type (bool need_header, mode_t *p_file_type) + if ((pch_rename () || pch_copy ()) + && ! inname + && ! ((i == OLD || i == NEW) && +- p_name[! reverse] && ++ p_name[reverse] && p_name[! reverse] && ++ name_is_valid (p_name[reverse]) && + name_is_valid (p_name[! reverse]))) + { + say ("Cannot %s file without two valid file names\n", pch_rename () ? "rename" : "copy"); +-- +2.7.4 +
meta/recipes-devtools/patch/patch_2.7.6.bb +3 -1
@@ -1,7 +1,9 @@ require patch.inc LICENSE = "GPLv3" -SRC_URI += "file://0001-Unset-need_charset_alias-when-building-for-musl.patch" +SRC_URI += "file://0001-Unset-need_charset_alias-when-building-for-musl.patch \ + file://0002-Fix-segfault-with-mangled-rename-patch.patch \ +" SRC_URI[md5sum] = "4c68cee989d83c87b00a3860bcd05600" SRC_URI[sha256sum] = "8cf86e00ad3aaa6d26aca30640e86b0e3e1f395ed99f189b06d4c9f74bc58a4e"
Signature · 1 line
2.11.0
PATCH 2/2 patch: fix CVE-2018-1000156
In reply to [email protected]From: Jackie Huang <[email protected]>
* 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.
--- ...-files-to-be-missing-for-ed-style-patches.patch | 38 ++++ ...ry-command-execution-in-ed-style-patches-.patch | 215 +++++++++++++++++++++ meta/recipes-devtools/patch/patch_2.7.6.bb | 2 + 3 files changed, 255 insertions(+) create mode 100644 meta/recipes-devtools/patch/patch/0003-Allow-input-files-to-be-missing-for-ed-style-patches.patch create mode 100644 meta/recipes-devtools/patch/patch/0004-Fix-arbitrary-command-execution-in-ed-style-patches-.patch
meta/recipes-devtools/patch/patch/0003-Allow-input-files-to-be-missing-for-ed-style-patches.patch new file +38 -0
@@ -0,0 +1,38 @@ +From b5a91a01e5d0897facdd0f49d64b76b0f02b43e1 Mon Sep 17 00:00:00 2001 +From: Andreas Gruenbacher <[email protected]> +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 <[email protected]> +--- + 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 +
meta/recipes-devtools/patch/patch/0004-Fix-arbitrary-command-execution-in-ed-style-patches-.patch new file +215 -0
215 lines not on this page · raw message
meta/recipes-devtools/patch/patch_2.7.6.bb +2 -0
@@ -3,6 +3,8 @@ LICENSE = "GPLv3" SRC_URI += "file://0001-Unset-need_charset_alias-when-building-for-musl.patch \ file://0002-Fix-segfault-with-mangled-rename-patch.patch \ + file://0003-Allow-input-files-to-be-missing-for-ed-style-patches.patch \ + file://0004-Fix-arbitrary-command-execution-in-ed-style-patches-.patch \ " SRC_URI[md5sum] = "4c68cee989d83c87b00a3860bcd05600"
Signature · 1 line
2.11.0