]> The Tcpdump Group git mirrors - tcpdump/blobdiff - print-egp.c
DNS: Sync types with IANA
[tcpdump] / print-egp.c
index dda505874adbbcf39bd662689d7db8f367ca3120..cc9f44e3c09e182ed78e4bef74f0545b44f59a21 100644 (file)
@@ -26,8 +26,6 @@
 #include <config.h>
 #endif
 
-#include <string.h>
-
 #include "netdissect-stdinc.h"
 
 #include "netdissect.h"
@@ -188,20 +186,18 @@ egpnr_print(netdissect_options *ndo,
                length -= 4 - netlen;
                if (length < 1)
                        goto trunc;
-               ND_TCHECK_1(cp);
                distances = GET_U_1(cp);
                cp++;
                length--;
                ND_PRINT(" %s %s ",
                       gateways < intgw ? "int" : "ext",
-                      ipaddr_string(ndo, (const u_char *)&addr));
+                      ipaddr_string(ndo, (const u_char *)&addr)); /* local buffer, not packet data; don't use GET_IPADDR_STRING() */
 
                comma = "";
                ND_PRINT("(");
                while (distances != 0) {
                        if (length < 2)
                                goto trunc;
-                       ND_TCHECK_2(cp);
                        ND_PRINT("%sd%u:", comma, GET_U_1(cp));
                        cp++;
                        comma = ", ";
@@ -212,28 +208,25 @@ egpnr_print(netdissect_options *ndo,
                                /* Pickup network number */
                                if (length < 1)
                                        goto trunc;
-                               ND_TCHECK_1(cp);
                                addr = ((uint32_t) GET_U_1(cp)) << 24;
                                cp++;
                                length--;
                                if (IN_CLASSB(addr)) {
                                        if (length < 1)
                                                goto trunc;
-                                       ND_TCHECK_1(cp);
                                        addr |= ((uint32_t) GET_U_1(cp)) << 16;
                                        cp++;
                                        length--;
                                } else if (!IN_CLASSA(addr)) {
                                        if (length < 2)
                                                goto trunc;
-                                       ND_TCHECK_2(cp);
                                        addr |= ((uint32_t) GET_U_1(cp)) << 16;
                                        cp++;
                                        addr |= ((uint32_t) GET_U_1(cp)) << 8;
                                        cp++;
                                        length -= 2;
                                }
-                               ND_PRINT(" %s", ipaddr_string(ndo, (const u_char *)&addr));
+                               ND_PRINT(" %s", ipaddr_string(ndo, (const u_char *)&addr)); /* local buffer, not packet data; don't use GET_IPADDR_STRING() */
                                networks--;
                        }
                        distances--;