From: Florian Weimer Date: Tue, 1 Aug 2023 08:27:15 +0000 (+0200) Subject: stdlib: Improve tst-realpath compatibility with source fortification X-Git-Tag: glibc-2.39~541 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=510fc20d73de12c85823d9996faac74666e9c2e7;p=thirdparty%2Fglibc.git 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 --git a/stdlib/tst-realpath.c b/stdlib/tst-realpath.c index f325c95a448..3694ecd8af3 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