diff options
| author | sin | 2015-05-13 12:04:15 +0100 |
|---|---|---|
| committer | sin | 2015-05-13 12:05:29 +0100 |
| commit | 158782b3bb791eae3c97947944c7023452bfbc96 (patch) | |
| tree | b76e70744ab0a2f76d781a65a0456b1b010c54df /include/stdlib.h | |
| parent | 316a48653315b4bc36d8c50b542471b18441c9d5 (diff) | |
Add fortify_fn() helper in fortify-headers.h
Diffstat (limited to 'include/stdlib.h')
| -rw-r--r-- | include/stdlib.h | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/include/stdlib.h b/include/stdlib.h index 0c4a7a6..16102ad 100644 --- a/include/stdlib.h +++ b/include/stdlib.h | |||
| @@ -8,6 +8,7 @@ | |||
| 8 | #endif | 8 | #endif |
| 9 | 9 | ||
| 10 | #if defined(_FORTIFY_SOURCE) && _FORTIFY_SOURCE > 0 && defined(__OPTIMIZE__) && __OPTIMIZE__ > 0 | 10 | #if defined(_FORTIFY_SOURCE) && _FORTIFY_SOURCE > 0 && defined(__OPTIMIZE__) && __OPTIMIZE__ > 0 |
| 11 | #include "fortify-headers.h" | ||
| 11 | 12 | ||
| 12 | #ifdef __cplusplus | 13 | #ifdef __cplusplus |
| 13 | extern "C" { | 14 | extern "C" { |
| @@ -15,9 +16,7 @@ extern "C" { | |||
| 15 | 16 | ||
| 16 | #if defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) || defined(_BSD_SOURCE) | 17 | #if defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) || defined(_BSD_SOURCE) |
| 17 | #undef realpath | 18 | #undef realpath |
| 18 | __typeof__(realpath) __realpath_orig __asm__(__USER_LABEL_PREFIX__ "realpath"); | 19 | fortify_fn(realpath) char *realpath(const char *path, char *resolved) |
| 19 | extern __inline __attribute__((__always_inline__,__gnu_inline__,__artificial__)) | ||
| 20 | char *realpath(const char *path, char *resolved) | ||
| 21 | { | 20 | { |
| 22 | size_t bos; | 21 | size_t bos; |
| 23 | 22 | ||
| @@ -30,7 +29,7 @@ char *realpath(const char *path, char *resolved) | |||
| 30 | __builtin_trap(); | 29 | __builtin_trap(); |
| 31 | #endif | 30 | #endif |
| 32 | } | 31 | } |
| 33 | return __realpath_orig(path, resolved); | 32 | return __orig_realpath(path, resolved); |
| 34 | } | 33 | } |
| 35 | #endif | 34 | #endif |
| 36 | 35 | ||
