diff options
| author | jvoisin | 2026-05-01 00:48:04 +0200 |
|---|---|---|
| committer | jvoisin | 2026-05-01 00:48:04 +0200 |
| commit | e8e2d1214a49f3c268fb5f3a92e8144b23e35243 (patch) | |
| tree | 9d2c053b192129d1ae501725b5686f5b788dd1bd | |
| parent | 1457895d6b34cf2bfc5fddd56becaa08d4b2edfe (diff) | |
Apparently, some horrible systems are leaving PATH_MAX *intentionally*
undefined, as paths can be unbounded there. We don't want to silently
introduced a limit in the trnaslation unit, so let's undefine it at the end of
the function.
| -rw-r--r-- | include/stdlib.h | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/include/stdlib.h b/include/stdlib.h index c95bb55..bb10a7f 100644 --- a/include/stdlib.h +++ b/include/stdlib.h | |||
| @@ -45,6 +45,7 @@ _FORTIFY_FN(realpath) char *realpath(const char *__p, char *__r) | |||
| 45 | #ifndef PATH_MAX | 45 | #ifndef PATH_MAX |
| 46 | /* see man realpath(3) */ | 46 | /* see man realpath(3) */ |
| 47 | #define PATH_MAX 4096 | 47 | #define PATH_MAX 4096 |
| 48 | #define _FORTIFY_UNDEF_PATH_MAX | ||
| 48 | #endif | 49 | #endif |
| 49 | if (__r && PATH_MAX > __bos(__r, 2)) { | 50 | if (__r && PATH_MAX > __bos(__r, 2)) { |
| 50 | char __buf[PATH_MAX], *__ret; | 51 | char __buf[PATH_MAX], *__ret; |
| @@ -61,6 +62,10 @@ _FORTIFY_FN(realpath) char *realpath(const char *__p, char *__r) | |||
| 61 | } | 62 | } |
| 62 | return __orig_realpath(__p, __r); | 63 | return __orig_realpath(__p, __r); |
| 63 | } | 64 | } |
| 65 | #ifdef _FORTIFY_UNDEF_PATH_MAX | ||
| 66 | #undef PATH_MAX | ||
| 67 | #undef _FORTIFY_UNDEF_PATH_MAX | ||
| 68 | #endif | ||
| 64 | #endif | 69 | #endif |
| 65 | 70 | ||
| 66 | #ifdef __cplusplus | 71 | #ifdef __cplusplus |
