]> git.ipfire.org Git - people/pmueller/ipfire-2.x.git/blame - src/patches/glibc-2.38/0022-string-Fix-tester-build-with-fortify-enable-with-gcc.patch
initscripts: Implement storing PIDs in loadproc
[people/pmueller/ipfire-2.x.git] / src / patches / glibc-2.38 / 0022-string-Fix-tester-build-with-fortify-enable-with-gcc.patch
CommitLineData
b9215da1
MT
1From d94461bb86ba176b9390c0015bb612a528e22d95 Mon Sep 17 00:00:00 2001
2From: Mahesh Bodapati <bmahi496@linux.ibm.com>
3Date: Fri, 11 Aug 2023 10:38:25 -0500
4Subject: [PATCH 22/27] string: Fix tester build with fortify enable with gcc <
5 12
6
7When building with fortify enabled, GCC < 12 issues a warning on the
8fortify strncat wrapper might overflow the destination buffer (the
9failure is tied to -Werror).
10
11Checked on ppc64 and x86_64.
12Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
13
14(cherry picked from commit f1c7ed0859a45929136836341741c7cd70f428cb)
15---
16 string/tester.c | 11 ++++++++---
17 1 file changed, 8 insertions(+), 3 deletions(-)
18
19diff --git a/string/tester.c b/string/tester.c
20index f7d4bac5a8..824cf315ff 100644
21--- a/string/tester.c
22+++ b/string/tester.c
23@@ -34,6 +34,14 @@
24 DIAG_IGNORE_NEEDS_COMMENT (8, "-Wstringop-truncation");
25 #endif
26
27+/* When building with fortify enabled, GCC < 12 issues a warning on the
28+ fortify strncat wrapper might overflow the destination buffer (the
29+ failure is tied to -Werror).
30+ Triggered by strncat fortify wrapper when it is enabled. */
31+#if __GNUC_PREREQ (11, 0)
32+DIAG_IGNORE_NEEDS_COMMENT (11, "-Wstringop-overread");
33+#endif
34+
35 #include <errno.h>
36 #include <stdint.h>
37 #include <stdio.h>
38@@ -52,9 +60,6 @@ DIAG_IGNORE_NEEDS_COMMENT (5.0, "-Wmemset-transposed-args");
39 DIAG_IGNORE_NEEDS_COMMENT (9, "-Wrestrict");
40 DIAG_IGNORE_NEEDS_COMMENT (7, "-Wstringop-overflow=");
41 #endif
42-#if __GNUC_PREREQ (11, 0)
43-DIAG_IGNORE_NEEDS_COMMENT (11, "-Wstringop-overread");
44-#endif
45
46
47 #define STREQ(a, b) (strcmp((a), (b)) == 0)
48--
492.39.2
50