Skip to content

Commit

Permalink
Bug #811 - add check for invalid jnpr header length
Browse files Browse the repository at this point in the history
  • Loading branch information
fklassen committed Jun 8, 2024
1 parent da44ab1 commit f96c4a1
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/tcpedit/plugins/dlt_jnpr_ether/jnpr_ether.c
Original file line number Diff line number Diff line change
Expand Up @@ -302,6 +302,13 @@ dlt_jnpr_ether_proto(tcpeditdlt_t *ctx, const u_char *packet, int pktlen)
memcpy(&jnpr_hdr_len, &packet[JUNIPER_ETHER_EXTLEN_OFFSET], 2);

jnpr_hdr_len = ntohs(jnpr_hdr_len) + JUNIPER_ETHER_HEADER_LEN;
if (jnpr_hdr_len > pktlen) {
tcpedit_seterr(ctx->tcpedit,
"Juniper header length %d invalid: it is greater than packet length %d",
jnpr_hdr_len, pktlen);
return TCPEDIT_ERROR;
}

ethernet = packet + jnpr_hdr_len;

/* let the en10mb plugin do the rest of the work */
Expand Down

0 comments on commit f96c4a1

Please sign in to comment.