fortify-headers

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

commit c2b0ad0bf55d5fe63c6e56e64cbd252a772dbbc0
parent 2b6657b759551ce485746d3e7f59725fa9f28dbf
Author: sin <sin@2f30.org>
Date:   Fri, 13 Mar 2015 14:22:41 +0000

Re-order vsnprintf() and vsprintf()

vsprintf() needs to access __vsnprintf_orig().

Diffstat:
Minclude/stdio.h | 24++++++++++++------------
1 file changed, 12 insertions(+), 12 deletions(-)

diff --git a/include/stdio.h b/include/stdio.h @@ -54,6 +54,18 @@ size_t fwrite(const void *dst, size_t n, size_t nmemb, FILE *fp) return __fwrite_orig(dst, n, nmemb, fp); } +extern int __vsnprintf_orig(char *, size_t, const char *, __builtin_va_list) + __asm__(__USER_LABEL_PREFIX__ "vsnprintf"); +extern __inline __attribute__((__always_inline__,__gnu_inline__)) +int vsnprintf(char *s, size_t n, const char *fmt, __builtin_va_list ap) +{ + size_t bos = __builtin_object_size(s, 0); + + if (n > bos) + __builtin_trap(); + return __vsnprintf_orig(s, n, fmt, ap); +} + extern int __vsprintf_orig(char *, const char *, __builtin_va_list) __asm__(__USER_LABEL_PREFIX__ "vsprintf"); extern __inline __attribute__((__always_inline__,__gnu_inline__)) @@ -72,18 +84,6 @@ int vsprintf(char *s, const char *fmt, __builtin_va_list ap) return r; } -extern int __vsnprintf_orig(char *, size_t, const char *, __builtin_va_list) - __asm__(__USER_LABEL_PREFIX__ "vsnprintf"); -extern __inline __attribute__((__always_inline__,__gnu_inline__)) -int vsnprintf(char *s, size_t n, const char *fmt, __builtin_va_list ap) -{ - size_t bos = __builtin_object_size(s, 0); - - if (n > bos) - __builtin_trap(); - return __vsnprintf_orig(s, n, fmt, ap); -} - #undef snprintf #define snprintf(s, n, fmt, ...) ({ \ size_t _n = n; \