diff --git a/packet01-parsing/xdp_prog_kern.c b/packet01-parsing/xdp_prog_kern.c index 14a221c9..4500bca6 100644 --- a/packet01-parsing/xdp_prog_kern.c +++ b/packet01-parsing/xdp_prog_kern.c @@ -36,7 +36,7 @@ static __always_inline int parse_ethhdr(struct hdr_cursor *nh, /* Byte-count bounds check; check if current pointer + size of header * is after data_end. */ - if (nh->pos + 1 > data_end) + if (nh->pos + hdrsize > data_end) return -1; nh->pos += hdrsize;