From 3cd2d4f942b75a913e54a64b506c9f58c009e38b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Edwin=20T=C3=B6r=C3=B6k?= Date: Tue, 18 Feb 2025 18:19:04 +0000 Subject: [PATCH] CA-406953: Fix pointer truncation in assert code MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The assert here checks for alignment, so technically truncating the upper bits is not wrong, but use the correct size. Signed-off-by: Edwin Török --- lib/statefileio.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/statefileio.c b/lib/statefileio.c index a3322bc..1b0593e 100755 --- a/lib/statefileio.c +++ b/lib/statefileio.c @@ -39,6 +39,7 @@ #include #include #include +#include #include #include #include @@ -354,7 +355,7 @@ sf_checksum( { MTC_U32 sum = 0; - assert((((MTC_U32)p) & 3) == 0 && (((MTC_U32)end) & 3) == 0); + assert((((uintptr_t)p) & 3) == 0 && (((uintptr_t)end) & 3) == 0); while (p < end) {