From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 7910) id 509703858D1E; Sun, 6 Aug 2023 16:14:59 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 509703858D1E DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1691338499; bh=7a4yNvCPumV7UX2O9wHHF8XPyV5hTno1C+9pxCepEIU=; h=From:To:Subject:Date:From; b=f+MdxRwm9SkRz6bajCIs0sFzlGjSbV1mCtU+PpnlnwK6YxKaZb90Q39OHbT1o25zK wwkQpY5qGnpzZMQL1Vws7Eiv48LWu6/NLhvum9gQYBqkq4XoKynUxsxlPS5Gpl2+RC ApqOdGZe8Qwa292/p0pQM6w03az4jK4ZUVBc3YIA= Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: Andreas K. Huttel To: glibc-cvs@sourceware.org Subject: [glibc/release/2.38/master] stdlib: Improve tst-realpath compatibility with source fortification X-Act-Checkin: glibc X-Git-Author: Florian Weimer X-Git-Refname: refs/heads/release/2.38/master X-Git-Oldrev: 36f2487f13e3540be9ee0fb51876b1da72176d3f X-Git-Newrev: d97cca1e5df812be0e4de1e38091f02bb1e7ec4e Message-Id: <20230806161459.509703858D1E@sourceware.org> Date: Sun, 6 Aug 2023 16:14:59 +0000 (GMT) List-Id: https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=d97cca1e5df812be0e4de1e38091f02bb1e7ec4e commit d97cca1e5df812be0e4de1e38091f02bb1e7ec4e 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. (cherry picked from commit 510fc20d73de12c85823d9996faac74666e9c2e7) 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