From a817e1555a755224cacc1cbdeeaefb6a1de606f0 Mon Sep 17 00:00:00 2001 From: jvoisin Date: Wed, 24 Apr 2024 17:09:08 +0200 Subject: Fix some overlap mismatch This was caught by the following test: ``` int main(void) { char c[32]; memcpy(c, c + 16, 16); } ``` Reported-by: q66 --- include/fortify-headers.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'include/fortify-headers.h') diff --git a/include/fortify-headers.h b/include/fortify-headers.h index ea2e430..796fd2d 100644 --- 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)) \ + ((a) < (b) && (b) < ((a) + (__fh_size_t)(len_a))) \ + || ((b) < (a) && (a) < ((b) + (__fh_size_t)(len_b))) \ ) /* -- cgit v1.3