fortify-headers

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

commit 1118911981c4ee56b90328c04dda14935b3d5525
parent 2ced6e28c30c98428a85a3c3fac7758d1ddf12b6
Author: sin <sin@2f30.org>
Date:   Tue,  3 Mar 2015 16:59:33 +0000

Don't trap on error for vsprintf() and friends

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

diff --git a/include/stdio.h b/include/stdio.h @@ -54,7 +54,7 @@ __fortify_vsprintf(char *s, const char *fmt, __builtin_va_list ap) if (bos != -1) { r = vsnprintf(s, bos, fmt, ap); - if (r == -1 || (size_t)r >= bos) + if (r != -1 && (size_t)r >= bos) __builtin_trap(); } else { r = vsprintf(s, fmt, ap); @@ -102,7 +102,7 @@ __fortify_vsnprintf(char *s, size_t n, const char *fmt, __builtin_va_list ap) int r; \ if (bos != -1) { \ r = (snprintf)(s, bos, fmt, ## __VA_ARGS__); \ - if (r == -1 || (size_t)r >= bos) \ + if (r != -1 && (size_t)r >= bos) \ __builtin_trap(); \ } else { \ r = (sprintf)(s, fmt, ## __VA_ARGS__); \