From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp.gentoo.org (woodpecker.gentoo.org [140.211.166.183]) by sourceware.org (Postfix) with ESMTP id AD3C13858D35 for ; Sun, 6 Aug 2023 16:56:34 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org AD3C13858D35 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=gentoo.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gentoo.org From: =?UTF-8?q?Andreas=20K=2E=20H=C3=BCttel?= To: libc-stable@sourceware.org Cc: "Andreas K . Huettel" Subject: [PATCH, committed 2.38] stdlib: Improve tst-realpath compatibility with source fortification Date: Sun, 6 Aug 2023 18:54:55 +0200 Message-ID: <20230806165555.1434064-1-dilfridge@gentoo.org> X-Mailer: git-send-email 2.41.0 MIME-Version: 1.0 Orig-From: Florian Weimer Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-9.6 required=5.0 tests=BAYES_00,GIT_PATCH_0,JMQ_SPF_NEUTRAL,KAM_DMARC_STATUS,KAM_SHORT,RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_PASS,SPF_PASS,TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: From: Andreas K. Huettel On GCC before 11, IPA can make the fortified realpath aware that the buffer size is not large enough (8 bytes instead of PATH_MAX bytes). Fix this by using a buffer that is large enough. (cherry picked from commit 510fc20d73de12c85823d9996faac74666e9c2e7) --- stdlib/tst-realpath.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/stdlib/tst-realpath.c b/stdlib/tst-realpath.c index f325c95a44..3694ecd8af 100644 --- a/stdlib/tst-realpath.c +++ b/stdlib/tst-realpath.c @@ -24,6 +24,7 @@ License along with the GNU C Library; if not, see . */ +#include #include #include #include @@ -50,7 +51,11 @@ void dealloc (void *p) char* alloc (void) { - return (char *)malloc (8); +#ifdef PATH_MAX + return (char *)malloc (PATH_MAX); +#else + return (char *)malloc (4096); +#endif } static int -- 2.41.0