fortify-headers

standalone fortify-source implementation
git clone git://git.2f30.org/fortify-headers
Log | Files | Refs | README | LICENSE

commit f54195479d315568ad4f7541ef33dc1d36a986b8
parent 37b438f146d52b5d09ed580949075aa11443a67a
Author: sin <sin@2f30.org>
Date:   Wed, 28 Jan 2015 23:40:17 +0000

Use BSD-style func defs

Diffstat:
Minclude/stdio.h | 4+++-
Minclude/string.h | 36++++++++++++++++++++++++------------
2 files changed, 27 insertions(+), 13 deletions(-)

diff --git a/include/stdio.h b/include/stdio.h @@ -9,7 +9,9 @@ static inline __attribute__ ((always_inline)) __attribute__ ((__format__ (printf, 3, 0))) __attribute__ ((__nonnull__ (3))) -int __fortify_vsnprintf(char *__restrict s, size_t n, const char *__restrict fmt, __builtin_va_list ap) +int +__fortify_vsnprintf(char *__restrict s, size_t n, const char *__restrict fmt, + __builtin_va_list ap) { size_t bos = __builtin_object_size(s, 0); diff --git a/include/string.h b/include/string.h @@ -6,7 +6,8 @@ #if defined(_FORTIFY_SOURCE) && _FORTIFY_SOURCE > 0 && defined(__OPTIMIZE__) && __OPTIMIZE__ > 0 static inline __attribute__ ((always_inline)) -void *__fortify_memcpy(void *__restrict dest, const void *__restrict src, size_t n) +void * +__fortify_memcpy(void *__restrict dest, const void *__restrict src, size_t n) { size_t bos = __builtin_object_size(dest, 0); @@ -16,7 +17,8 @@ void *__fortify_memcpy(void *__restrict dest, const void *__restrict src, size_t } static inline __attribute__ ((always_inline)) -void *__fortify_memmove(void *__restrict dest, const void *__restrict src, size_t n) +void * +__fortify_memmove(void *__restrict dest, const void *__restrict src, size_t n) { size_t bos = __builtin_object_size(dest, 0); @@ -26,7 +28,8 @@ void *__fortify_memmove(void *__restrict dest, const void *__restrict src, size_ } static inline __attribute__ ((always_inline)) -void *__fortify_memset(void *dest, int c, size_t n) +void * +__fortify_memset(void *dest, int c, size_t n) { size_t bos = __builtin_object_size(dest, 0); @@ -36,7 +39,8 @@ void *__fortify_memset(void *dest, int c, size_t n) } static inline __attribute__ ((always_inline)) -char *__fortify_stpcpy(char *__restrict dest, const char *__restrict src) +char * +__fortify_stpcpy(char *__restrict dest, const char *__restrict src) { size_t bos = __builtin_object_size(dest, 0); @@ -46,7 +50,8 @@ char *__fortify_stpcpy(char *__restrict dest, const char *__restrict src) } static inline __attribute__ ((always_inline)) -char *__fortify_stpncpy(char *__restrict dest, const char *__restrict src, size_t n) +char * +__fortify_stpncpy(char *__restrict dest, const char *__restrict src, size_t n) { size_t bos = __builtin_object_size(dest, 0); @@ -56,7 +61,8 @@ char *__fortify_stpncpy(char *__restrict dest, const char *__restrict src, size_ } static inline __attribute__ ((always_inline)) -char *__fortify_strcat(char *__restrict dest, const char *__restrict src) +char * +__fortify_strcat(char *__restrict dest, const char *__restrict src) { size_t bos = __builtin_object_size(dest, 0); @@ -66,7 +72,8 @@ char *__fortify_strcat(char *__restrict dest, const char *__restrict src) } static inline __attribute__ ((always_inline)) -char *__fortify_strcpy(char *__restrict dest, const char *__restrict src) +char * +__fortify_strcpy(char *__restrict dest, const char *__restrict src) { size_t bos = __builtin_object_size(dest, 0); @@ -76,7 +83,8 @@ char *__fortify_strcpy(char *__restrict dest, const char *__restrict src) } static inline __attribute__ ((always_inline)) -char *__fortify_strncat(char *__restrict dest, const char *__restrict src, size_t n) +char * +__fortify_strncat(char *__restrict dest, const char *__restrict src, size_t n) { size_t bos = __builtin_object_size(dest, 0); size_t slen, dlen; @@ -93,7 +101,8 @@ char *__fortify_strncat(char *__restrict dest, const char *__restrict src, size_ } static inline __attribute__ ((always_inline)) -char *__fortify_strncpy(char *__restrict dest, const char *__restrict src, size_t n) +char * +__fortify_strncpy(char *__restrict dest, const char *__restrict src, size_t n) { size_t bos = __builtin_object_size(dest, 0); @@ -104,7 +113,8 @@ char *__fortify_strncpy(char *__restrict dest, const char *__restrict src, size_ #ifdef _GNU_SOURCE static inline __attribute__ ((always_inline)) -void *__fortify_mempcpy(void *__restrict dest, const void *__restrict src, size_t n) +void * +__fortify_mempcpy(void *__restrict dest, const void *__restrict src, size_t n) { size_t bos = __builtin_object_size(dest, 0); @@ -116,7 +126,8 @@ void *__fortify_mempcpy(void *__restrict dest, const void *__restrict src, size_ #if defined(_GNU_SOURCE) || defined(_BSD_SOURCE) static inline __attribute__ ((always_inline)) -size_t __fortify_strlcat(char *__restrict dest, const char *__restrict src, size_t n) +size_t +__fortify_strlcat(char *__restrict dest, const char *__restrict src, size_t n) { size_t bos = __builtin_object_size(dest, 0); @@ -126,7 +137,8 @@ size_t __fortify_strlcat(char *__restrict dest, const char *__restrict src, size } static inline __attribute__ ((always_inline)) -size_t __fortify_strlcpy(char *__restrict dest, const char *__restrict src, size_t n) +size_t +__fortify_strlcpy(char *__restrict dest, const char *__restrict src, size_t n) { size_t bos = __builtin_object_size(dest, 0);