3 @@ -1368,19 +1368,29 @@ trunc:
8 + * Un-escape RFC 1662 PPP in HDLC-like framing, with octet escapes.
9 + * The length argument is the on-the-wire length, not the captured
10 + * length; we can only un-escape the captured part.
13 ppp_hdlc(netdissect_options *ndo,
14 const u_char *p, int length)
16 + u_int caplen = ndo->ndo_snapend - p;
30 - b = (u_char *)malloc(length);
31 + b = (u_char *)malloc(caplen);
35 @@ -1389,10 +1399,10 @@ ppp_hdlc(netdissect_options *ndo,
36 * Do this so that we dont overwrite the original packet
39 - for (s = p, t = b, i = length; i > 0 && ND_TTEST(*s); i--) {
40 + for (s = p, t = b, i = caplen; i != 0; i--) {
43 - if (i <= 1 || !ND_TTEST(*s))