]> The Tcpdump Group git mirrors - tcpdump/commitdiff
IP: Update ip_printroute() to a void function
authorFrancois-Xavier Le Bail <[email protected]>
Sun, 20 Sep 2020 13:25:43 +0000 (15:25 +0200)
committerFrancois-Xavier Le Bail <[email protected]>
Sun, 20 Sep 2020 13:34:06 +0000 (15:34 +0200)
The function no more return in case of truncation (longjmp() because
no more ND_TCHECK_4()).

This is a follow-up to commit aad6ac30.

print-ip.c

index 891ce19ba1c50194ab23316ffe35dd89f11406cd..0f09b04e8ebe1744446ef800ef65d818c8eb96af 100644 (file)
@@ -53,7 +53,7 @@ static const struct tok ip_option_values[] = {
 /*
  * print the recorded route in an IP RR, LSRR or SSRR option.
  */
-static int
+static void
 ip_printroute(netdissect_options *ndo,
               const u_char *cp, u_int length)
 {
@@ -62,7 +62,7 @@ ip_printroute(netdissect_options *ndo,
 
        if (length < 3) {
                ND_PRINT(" [bad length %u]", length);
-               return (0);
+               return;
        }
        if ((length + 1) & 3)
                ND_PRINT(" [bad length %u]", length);
@@ -75,7 +75,6 @@ ip_printroute(netdissect_options *ndo,
                if (ptr > len)
                        ND_PRINT(",");
        }
-       return (0);
 }
 
 /*
@@ -274,8 +273,7 @@ ip_optprint(netdissect_options *ndo,
                case IPOPT_RR:       /* fall through */
                case IPOPT_SSRR:
                case IPOPT_LSRR:
-                       if (ip_printroute(ndo, cp, option_len) == -1)
-                               goto trunc;
+                       ip_printroute(ndo, cp, option_len);
                        break;
 
                case IPOPT_RA: