aboutgitcodebugslistschat
path: root/packet.c
diff options
context:
space:
mode:
authorStefano Brivio <sbrivio@redhat.com>2022-04-05 07:24:48 +0200
committerStefano Brivio <sbrivio@redhat.com>2022-04-07 11:44:35 +0200
commit0786b2e60a71c94b4243224d01a810a4a52b8b72 (patch)
tree944e0f35641d5d37b755c72b11436838dbed6f13 /packet.c
parent48bc843d6e406a142b5b07e57a3d7d242c2bed03 (diff)
downloadpasst-0786b2e60a71c94b4243224d01a810a4a52b8b72.tar
passt-0786b2e60a71c94b4243224d01a810a4a52b8b72.tar.gz
passt-0786b2e60a71c94b4243224d01a810a4a52b8b72.tar.bz2
passt-0786b2e60a71c94b4243224d01a810a4a52b8b72.tar.lz
passt-0786b2e60a71c94b4243224d01a810a4a52b8b72.tar.xz
passt-0786b2e60a71c94b4243224d01a810a4a52b8b72.tar.zst
passt-0786b2e60a71c94b4243224d01a810a4a52b8b72.zip
conf, packet: Operands don't affect result, CWE-569
Reported by Coverity. Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
Diffstat (limited to 'packet.c')
-rw-r--r--packet.c4
1 files changed, 3 insertions, 1 deletions
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;