Skip to content
Snippets Groups Projects
Commit e9b2bc19 authored by Samuel Thibault's avatar Samuel Thibault
Browse files

TCPIPHDR_DELTA: Fix potential negative value


sizeof() returns a size_t so the tcpiphdr / ip+tcphdr difference will be
a size_t and always be >= 0, while this intended to detect the
difference getting < 0.

This is actually a no-op with the current code because it currently has
tcpiphdr bigger than ip+tcphdr.

Spotted by Coverity: CID 212435.
Spotted by Coverity: CID 212440.

Signed-off-by: default avatarSamuel Thibault <samuel.thibault@ens-lyon.org>
parent a4e41a7e
No related branches found
No related tags found
No related merge requests found
Pipeline #191378 passed
......@@ -88,8 +88,8 @@ struct tcpiphdr {
/* This is the difference between the size of a tcpiphdr structure, and the
* size of actual ip+tcp headers, rounded up since we need to align data. */
#define TCPIPHDR_DELTA \
(MAX(0, (sizeof(struct tcpiphdr) - sizeof(struct ip) - \
sizeof(struct tcphdr) + 3) & \
(MAX(0, ((int) sizeof(struct tcpiphdr) - (int) sizeof(struct ip) - \
(int) sizeof(struct tcphdr) + 3) & \
~3))
/*
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment