]> git.ipfire.org Git - people/mlorenz/ipfire-2.x.git/blame - src/patches/glibc-2.38/0001-stdlib-Improve-tst-realpath-compatibility-with-sourc.patch
glibc: Import patches from upstream
[people/mlorenz/ipfire-2.x.git] / src / patches / glibc-2.38 / 0001-stdlib-Improve-tst-realpath-compatibility-with-sourc.patch
CommitLineData
b9215da1
MT
1From d97cca1e5df812be0e4de1e38091f02bb1e7ec4e Mon Sep 17 00:00:00 2001
2From: Florian Weimer <fweimer@redhat.com>
3Date: Tue, 1 Aug 2023 10:27:15 +0200
4Subject: [PATCH 01/27] stdlib: Improve tst-realpath compatibility with source
5 fortification
6
7On GCC before 11, IPA can make the fortified realpath aware that the
8buffer size is not large enough (8 bytes instead of PATH_MAX bytes).
9Fix this by using a buffer that is large enough.
10
11(cherry picked from commit 510fc20d73de12c85823d9996faac74666e9c2e7)
12---
13 stdlib/tst-realpath.c | 7 ++++++-
14 1 file changed, 6 insertions(+), 1 deletion(-)
15
16diff --git a/stdlib/tst-realpath.c b/stdlib/tst-realpath.c
17index f325c95a44..3694ecd8af 100644
18--- a/stdlib/tst-realpath.c
19+++ b/stdlib/tst-realpath.c
20@@ -24,6 +24,7 @@
21 License along with the GNU C Library; if not, see
22 <https://www.gnu.org/licenses/>. */
23
24+#include <limits.h>
25 #include <stdio.h>
26 #include <stdlib.h>
27 #include <malloc.h>
28@@ -50,7 +51,11 @@ void dealloc (void *p)
29
30 char* alloc (void)
31 {
32- return (char *)malloc (8);
33+#ifdef PATH_MAX
34+ return (char *)malloc (PATH_MAX);
35+#else
36+ return (char *)malloc (4096);
37+#endif
38 }
39
40 static int
41--
422.39.2
43