]> The Tcpdump Group git mirrors - tcpdump/blobdiff - print-ppp.c
Regenerate config files.
[tcpdump] / print-ppp.c
index c16801fba31f6d02a877d6465a602e5385c1f4cd..ee8239c779250bfa7ba84c9984d6143af24ea19c 100644 (file)
@@ -944,6 +944,9 @@ handle_pap(netdissect_options *ndo,
 
        switch (code) {
        case PAP_AREQ:
+               /* A valid Authenticate-Request is 6 or more octets long. */
+               if (len < 6)
+                       goto trunc;
                if (length - (p - p0) < 1)
                        return;
                ND_TCHECK(*p);
@@ -972,6 +975,13 @@ handle_pap(netdissect_options *ndo,
                break;
        case PAP_AACK:
        case PAP_ANAK:
+               /* Although some implementations ignore truncation at
+                * this point and at least one generates a truncated
+                * packet, RFC 1334 section 2.2.2 clearly states that
+                * both AACK and ANAK are at least 5 bytes long.
+                */
+               if (len < 5)
+                       goto trunc;
                if (length - (p - p0) < 1)
                        return;
                ND_TCHECK(*p);
@@ -1671,6 +1681,11 @@ ppp_hdlc_if_print(netdissect_options *ndo,
                return (chdlc_if_print(ndo, h, p));
 
        default:
+               if (caplen < 4) {
+                       ND_PRINT((ndo, "[|ppp]"));
+                       return (caplen);
+               }
+
                if (ndo->ndo_eflag)
                        ND_PRINT((ndo, "%02x %02x %d ", p[0], p[1], length));
                p += 2;