From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 2178) id DF4C83858428; Tue, 1 Aug 2023 08:27:28 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org DF4C83858428 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1690878448; bh=bbiQwne19w4mpbR4AuP/ayU8Izgqhc4rYLfEMNLKF7Q=; h=From:To:Subject:Date:From; b=GVPWLyCgWkA3G50zg/2oj2tYrDqD2HCEw8HTFgvA2ck3Pbh9+LzaD6DlYpWiPYoeC BPe5LnfPvrr7aW8y6US6aQMKFn4UNCPOUb+JK0GPevufrSAwVzkJVZoY6SKQmvuqML E38fffTZIbocanXgEwTatJhyhmu3YnkLwRjflWTU= Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: Florian Weimer To: glibc-cvs@sourceware.org Subject: [glibc] stdlib: Improve tst-realpath compatibility with source fortification X-Act-Checkin: glibc X-Git-Author: Florian Weimer X-Git-Refname: refs/heads/master X-Git-Oldrev: 78ca34d8c55eee6b0664f9c1d30fcca71077b843 X-Git-Newrev: 510fc20d73de12c85823d9996faac74666e9c2e7 Message-Id: <20230801082728.DF4C83858428@sourceware.org> Date: Tue, 1 Aug 2023 08:27:28 +0000 (GMT) List-Id: https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=510fc20d73de12c85823d9996faac74666e9c2e7 commit 510fc20d73de12c85823d9996faac74666e9c2e7 Author: Florian Weimer Date: Tue Aug 1 10:27:15 2023 +0200 stdlib: Improve tst-realpath compatibility with source fortification 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. Diff: --- 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