From 0786b2e60a71c94b4243224d01a810a4a52b8b72 Mon Sep 17 00:00:00 2001 From: Stefano Brivio Date: Tue, 5 Apr 2022 07:24:48 +0200 Subject: conf, packet: Operands don't affect result, CWE-569 Reported by Coverity. Signed-off-by: Stefano Brivio --- packet.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'packet.c') diff --git a/packet.c b/packet.c index fa9e9b4..6d10ec1 100644 --- a/packet.c +++ b/packet.c @@ -57,11 +57,13 @@ void packet_add_do(struct pool *p, size_t len, const char *start, return; } - if ((unsigned int)((intptr_t)start - (intptr_t)p->buf) > UINT32_MAX) { +#if UINTPTR_MAX == UINT64_MAX + if ((uintptr_t)start - (uintptr_t)p->buf > UINT32_MAX) { trace("add packet start %p, buffer start %p, %s:%i", start, p->buf, func, line); return; } +#endif p->pkt[index].offset = start - p->buf; p->pkt[index].len = len; -- cgit v1.2.3