]> The Tcpdump Group git mirrors - tcpdump/commitdiff
IP: Update a length check
authorFrancois-Xavier Le Bail <[email protected]>
Sat, 7 Sep 2024 10:03:37 +0000 (12:03 +0200)
committerFrancois-Xavier Le Bail <[email protected]>
Sat, 19 Oct 2024 17:07:57 +0000 (19:07 +0200)
This should silence an erroneous 'ineffective_check' warning (Coverity
CID 1619168).

(cherry picked from commit 72095a100d236aa35efedd68d9297b65523cc989)

print-ip.c

index 5edc62215e2751d4d5f4dfb65b517f6faaf191c0..c32c6d41d0e6686426e1ecca153701c54e53f58a 100644 (file)
@@ -414,7 +414,7 @@ ip_print(netdissect_options *ndo,
            else
                 ND_PRINT(", length %u", GET_BE_U_2(ip->ip_len));
 
-            if ((hlen - sizeof(struct ip)) > 0) {
+            if ((hlen > sizeof(struct ip))) {
                 ND_PRINT(", options (");
                 if (ip_optprint(ndo, (const u_char *)(ip + 1),
                     hlen - sizeof(struct ip)) == -1) {