public inbox for libc-stable@sourceware.org
 help / color / mirror / Atom feed
From: "Andreas K. Hüttel" <dilfridge@gentoo.org>
To: libc-stable@sourceware.org
Cc: Mahesh Bodapati <bmahi496@linux.ibm.com>,
	Adhemerval Zanella <adhemerval.zanella@linaro.org>
Subject: [PATCH 2/3] string: Fix tester build with fortify enable with gcc < 12
Date: Sat, 16 Sep 2023 00:01:28 +0200	[thread overview]
Message-ID: <20230915220242.2825510-3-dilfridge@gentoo.org> (raw)
In-Reply-To: <20230915220242.2825510-1-dilfridge@gentoo.org>

From: Mahesh Bodapati <bmahi496@linux.ibm.com>

When building with fortify enabled, GCC < 12 issues a warning on the
fortify strncat wrapper might overflow the destination buffer (the
failure is tied to -Werror).

Checked on ppc64 and x86_64.
Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>

(cherry picked from commit f1c7ed0859a45929136836341741c7cd70f428cb)
---
 string/tester.c | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/string/tester.c b/string/tester.c
index f7d4bac5a8..824cf315ff 100644
--- a/string/tester.c
+++ b/string/tester.c
@@ -34,6 +34,14 @@
 DIAG_IGNORE_NEEDS_COMMENT (8, "-Wstringop-truncation");
 #endif
 
+/* When building with fortify enabled, GCC < 12 issues a warning on the
+   fortify strncat wrapper might overflow the destination buffer (the
+   failure is tied to -Werror).
+   Triggered by strncat fortify wrapper when it is enabled.  */
+#if __GNUC_PREREQ (11, 0)
+DIAG_IGNORE_NEEDS_COMMENT (11, "-Wstringop-overread");
+#endif
+
 #include <errno.h>
 #include <stdint.h>
 #include <stdio.h>
@@ -52,9 +60,6 @@ DIAG_IGNORE_NEEDS_COMMENT (5.0, "-Wmemset-transposed-args");
 DIAG_IGNORE_NEEDS_COMMENT (9, "-Wrestrict");
 DIAG_IGNORE_NEEDS_COMMENT (7, "-Wstringop-overflow=");
 #endif
-#if __GNUC_PREREQ (11, 0)
-DIAG_IGNORE_NEEDS_COMMENT (11, "-Wstringop-overread");
-#endif
 
 
 #define	STREQ(a, b)	(strcmp((a), (b)) == 0)
-- 
2.41.0


  parent reply	other threads:[~2023-09-15 22:02 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-09-15 22:01 [COMMITTED 2.38] A few small backports Andreas K. Hüttel
2023-09-15 22:01 ` [PATCH 1/3] iconv: restore verbosity with unrecognized encoding names (bug 30694) Andreas K. Hüttel
2023-09-15 22:01 ` Andreas K. Hüttel [this message]
2023-09-15 22:01 ` [PATCH 3/3] manual/jobs.texi: Add missing @item EPERM for getpgid Andreas K. Hüttel

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230915220242.2825510-3-dilfridge@gentoo.org \
    --to=dilfridge@gentoo.org \
    --cc=adhemerval.zanella@linaro.org \
    --cc=bmahi496@linux.ibm.com \
    --cc=libc-stable@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).