fortify-headers

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

commit 499ea65dd55279319419ff288790e17de629c9a7
parent 4b4dfea25d660a8a27e95ea531686001246b3d1e
Author: sin <sin@2f30.org>
Date:   Wed Mar 11 09:21:00 +0000

Revert "Fix invalid conversion in C++ code"

This reverts commit 4b4dfea25d660a8a27e95ea531686001246b3d1e.

Diffstat:
include/string.h | 6++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/include/string.h b/include/string.h @@ -10,11 +10,13 @@ void * __fortify_memcpy(void *dest, const void *src, size_t n) { size_t bos = __builtin_object_size(dest, 0); + char *d = dest; + const char *s = src; /* trap if pointers are overlapping but not if dest == src. * gcc seems to like to generate code that relies on dest == src */ - if ((dest < src && dest + n > src) || - (src < dest && src + n > dest)) + if ((d < s && d + n > s) || + (s < d && s + n > d)) __builtin_trap(); if (n > bos) __builtin_trap();