]> The Tcpdump Group git mirrors - tcpdump/commitdiff
esis: use ND_TTEST_LEN() and ND_BYTES_BETWEEN() on pointers.
authorGuy Harris <[email protected]>
Wed, 27 May 2020 05:13:02 +0000 (22:13 -0700)
committerGuy Harris <[email protected]>
Wed, 27 May 2020 05:13:02 +0000 (22:13 -0700)
Using ND_TTEST_LEN() makes the check a bit more stringent.

Using ND_BYTES_BETWEEN() casts the difference to a u_int, so it's 1)
unsigned and 2) not 64-bit on LP64 or LLP64 platforms.

print-isoclns.c

index 882da50a874e28064c13f09e1bde642def561a60..b5943cc7fdf50de8067b96d5a5fd6ed5243351e7 100644 (file)
@@ -1382,8 +1382,8 @@ esis_print(netdissect_options *ndo,
 
        default:
                if (ndo->ndo_vflag <= 1) {
-                       if (pptr < ndo->ndo_snapend)
-                               print_unknown_data(ndo, pptr, "\n\t  ", (int)(ndo->ndo_snapend - pptr));
+                       if (ND_TTEST_LEN(pptr, 1))
+                               print_unknown_data(ndo, pptr, "\n\t  ", ND_BYTES_AVAILABLE_AFTER(pptr));
                }
                return;
        }