fortify-headers

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

commit 520e7e4a631cc038b3e867b2255235da35a98ece
parent 6939e3382a232d20882c1c7e74274132de154bb6
Author: jvoisin <julien.voisin@dustri.org>
Date:   Fri, 14 Jun 2024 19:46:14 +0200

Fix some pointer-arithmetic warnings

This should fix the second part of #59

Diffstat:
Minclude/fortify-headers.h | 4++--
Mtests/Makefile | 2+-
2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/include/fortify-headers.h b/include/fortify-headers.h @@ -141,8 +141,8 @@ * since gcc seems to like to generate code that relies on dst == src */ #define __fh_overlap(a, len_a, b, len_b) \ ( \ - ((a) < (b) && (b) < ((a) + (__fh_size_t)(len_a))) \ - || ((b) < (a) && (a) < ((b) + (__fh_size_t)(len_b))) \ + ((char*)(a) < (char*)(b) && (char*)(b) < ((char*)(a) + (__fh_size_t)(len_a))) \ + || ((char*)(b) < (char*)(a) && (char*)(a) < ((char*)(b) + (__fh_size_t)(len_b))) \ ) /* diff --git a/tests/Makefile b/tests/Makefile @@ -1,4 +1,4 @@ -CFLAGS+=-I../include/ -D_FORTIFY_SOURCE=3 -static -O2 -DPEDANTIC_CHECKS -Wno-format +CFLAGS+=-I../include/ -D_FORTIFY_SOURCE=3 -static -O2 -DPEDANTIC_CHECKS -Wno-format -Werror=pointer-arith COMPTIME_TARGETS= \ test_memcpy_overwrite_under \