]> The Tcpdump Group git mirrors - tcpdump/blobdiff - print-ascii.c
Update ND_BYTES_AVAILABLE_AFTER() macro for better accuracy
[tcpdump] / print-ascii.c
index 27cf2df1d07441def5442f2e5ba8fe66d5dd2fc9..ce97444554d0a5a3796c4b281359a6616e14f2ed 100644 (file)
@@ -67,7 +67,7 @@ ascii_print(netdissect_options *ndo,
        int truncated = FALSE;
 
        ndo->ndo_protocol = "ascii";
-       caplength = (ndo->ndo_snapend > cp) ? ND_BYTES_AVAILABLE_AFTER(cp) : 0;
+       caplength = ND_BYTES_AVAILABLE_AFTER(cp);
        if (length > caplength) {
                length = caplength;
                truncated = TRUE;
@@ -113,7 +113,7 @@ hex_and_ascii_print_with_offset(netdissect_options *ndo, const char *indent,
        char hexstuff[HEXDUMP_SHORTS_PER_LINE*HEXDUMP_HEXSTUFF_PER_SHORT+1], *hsp;
        char asciistuff[ASCII_LINELENGTH+1], *asp;
 
-       caplength = (ndo->ndo_snapend > cp) ? ND_BYTES_AVAILABLE_AFTER(cp) : 0;
+       caplength = ND_BYTES_AVAILABLE_AFTER(cp);
        if (length > caplength) {
                length = caplength;
                truncated = TRUE;
@@ -181,7 +181,7 @@ hex_print_with_offset(netdissect_options *ndo,
        u_int nshorts;
        int truncated = FALSE;
 
-       caplength = (ndo->ndo_snapend > cp) ? ND_BYTES_AVAILABLE_AFTER(cp) : 0;
+       caplength = ND_BYTES_AVAILABLE_AFTER(cp);
        if (length > caplength) {
                length = caplength;
                truncated = TRUE;