From 6093e80932f72c8eec364cc03851a2386a0a2a39 Mon Sep 17 00:00:00 2001 From: Peter Kjellerstedt Date: Thu, 26 Apr 2018 02:20:33 +0200 Subject: patch: Make it build with compile time hardening enabled Signed-off-by: Peter Kjellerstedt --- ...build-with-compile-time-hardening-enabled.patch | 97 ++++++++++++++++++++++ recipes-devtools/patch/patch_2.5.9.bb | 3 +- 2 files changed, 99 insertions(+), 1 deletion(-) create mode 100644 recipes-devtools/patch/patch/0001-Make-it-build-with-compile-time-hardening-enabled.patch diff --git a/recipes-devtools/patch/patch/0001-Make-it-build-with-compile-time-hardening-enabled.patch b/recipes-devtools/patch/patch/0001-Make-it-build-with-compile-time-hardening-enabled.patch new file mode 100644 index 0000000..31d8632 --- /dev/null +++ b/recipes-devtools/patch/patch/0001-Make-it-build-with-compile-time-hardening-enabled.patch @@ -0,0 +1,97 @@ +From eae20c82ee6eb2f50482f7c90baaf001240ed084 Mon Sep 17 00:00:00 2001 +From: Peter Kjellerstedt +Date: Thu, 26 Apr 2018 02:15:43 +0200 +Subject: [PATCH] Make it build with compile time hardening enabled + +This avoids the following errors: + + patch.c: In function 'apply_hunk': + patch.c:1179:7: error: format not a string literal and no format + arguments [-Werror=format-security] + fprintf (fp, outstate->after_newline + else_defined); + ^~~~~~~ + patch.c:1198:7: error: format not a string literal and no format + arguments [-Werror=format-security] + fprintf (fp, outstate->after_newline + else_defined); + ^~~~~~~ + patch.c:1246:3: error: format not a string literal and no format + arguments [-Werror=format-security] + fprintf (fp, outstate->after_newline + else_defined); + ^~~~~~~ + patch.c:1265:3: error: format not a string literal and no format + arguments [-Werror=format-security] + fprintf (fp, outstate->after_newline + end_defined); + ^~~~~~~ + patch.c:1283:3: error: format not a string literal and no format + arguments [-Werror=format-security] + fprintf (fp, outstate->after_newline + else_defined); + ^~~~~~~ + patch.c:1302:2: error: format not a string literal and no format + arguments [-Werror=format-security] + fprintf (fp, outstate->after_newline + end_defined); + ^~~~~~~ + +Upstream-Status: Inappropriate [legacy version] +Signed-off-by: Peter Kjellerstedt +--- + patch.c | 12 ++++++------ + 1 file changed, 6 insertions(+), 6 deletions(-) + +diff --git a/patch.c b/patch.c +index 0d9a196..5e663a6 100644 +--- a/patch.c ++++ b/patch.c +@@ -1176,7 +1176,7 @@ apply_hunk (struct outstate *outstate, LINENUM where) + def_state = IN_IFNDEF; + } + else if (def_state == IN_IFDEF) { +- fprintf (fp, outstate->after_newline + else_defined); ++ fprintf (fp, "%s", outstate->after_newline + else_defined); + def_state = IN_ELSE; + } + if (ferror (fp)) +@@ -1195,7 +1195,7 @@ apply_hunk (struct outstate *outstate, LINENUM where) + return false; + if (R_do_defines) { + if (def_state == IN_IFNDEF) { +- fprintf (fp, outstate->after_newline + else_defined); ++ fprintf (fp, "%s", outstate->after_newline + else_defined); + def_state = IN_ELSE; + } + else if (def_state == OUTSIDE) { +@@ -1243,7 +1243,7 @@ apply_hunk (struct outstate *outstate, LINENUM where) + while (pch_char (old) == '!'); + + if (R_do_defines) { +- fprintf (fp, outstate->after_newline + else_defined); ++ fprintf (fp, "%s", outstate->after_newline + else_defined); + if (ferror (fp)) + write_fatal (); + def_state = IN_ELSE; +@@ -1262,7 +1262,7 @@ apply_hunk (struct outstate *outstate, LINENUM where) + old++; + new++; + if (R_do_defines && def_state != OUTSIDE) { +- fprintf (fp, outstate->after_newline + end_defined); ++ fprintf (fp, "%s", outstate->after_newline + end_defined); + if (ferror (fp)) + write_fatal (); + outstate->after_newline = true; +@@ -1280,7 +1280,7 @@ apply_hunk (struct outstate *outstate, LINENUM where) + def_state = IN_IFDEF; + } + else if (def_state == IN_IFNDEF) { +- fprintf (fp, outstate->after_newline + else_defined); ++ fprintf (fp, "%s", outstate->after_newline + else_defined); + def_state = IN_ELSE; + } + if (ferror (fp)) +@@ -1299,7 +1299,7 @@ apply_hunk (struct outstate *outstate, LINENUM where) + while (new <= pat_end && pch_char (new) == '+'); + } + if (R_do_defines && def_state != OUTSIDE) { +- fprintf (fp, outstate->after_newline + end_defined); ++ fprintf (fp, "%s", outstate->after_newline + end_defined); + if (ferror (fp)) + write_fatal (); + outstate->after_newline = true; diff --git a/recipes-devtools/patch/patch_2.5.9.bb b/recipes-devtools/patch/patch_2.5.9.bb index c29b240..f2970f7 100644 --- a/recipes-devtools/patch/patch_2.5.9.bb +++ b/recipes-devtools/patch/patch_2.5.9.bb @@ -4,7 +4,8 @@ LICENSE = "GPLv2" SRC_URI += " file://debian.patch \ file://install.patch \ file://unified-reject-files.diff \ - file://global-reject-file.diff " + file://global-reject-file.diff \ + file://0001-Make-it-build-with-compile-time-hardening-enabled.patch" PR = "r3" LIC_FILES_CHKSUM = "file://COPYING;md5=94d55d512a9ba36caa9b7df079bae19f" -- cgit v1.2.3-54-g00ecf