diff options
author | Florian Weimer <fweimer@redhat.com> | 2023-08-01 10:27:15 +0200 |
---|---|---|
committer | Andreas K. Hüttel <dilfridge@gentoo.org> | 2023-08-23 13:35:03 +0200 |
commit | ca9228846b6d7cca04fa29cd91f27d956146e3ff (patch) | |
tree | 8fb6f1378da20326de74229fd8c708fd714c713f | |
parent | linux: Use getdents64 on readdir64 compat implementation (diff) | |
download | glibc-ca9228846b6d7cca04fa29cd91f27d956146e3ff.tar.gz glibc-ca9228846b6d7cca04fa29cd91f27d956146e3ff.tar.bz2 glibc-ca9228846b6d7cca04fa29cd91f27d956146e3ff.zip |
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)
(cherry picked from commit d97cca1e5df812be0e4de1e38091f02bb1e7ec4e)
-rw-r--r-- | stdlib/tst-realpath.c | 7 |
1 files changed, 6 insertions, 1 deletions
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 <https://www.gnu.org/licenses/>. */ +#include <limits.h> #include <stdio.h> #include <stdlib.h> #include <malloc.h> @@ -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 |