Skip to content
This repository was archived by the owner on Dec 20, 2023. It is now read-only.

Commit 9ea2aa8

Browse files
committed
netfilter: nfnetlink: validate nfnetlink header from batch
Make sure there is enough room for the nfnetlink header in the netlink messages that are part of the batch. There is a similar check in netlink_rcv_skb(). Signed-off-by: Pablo Neira Ayuso <[email protected]>
1 parent 8ca3f5e commit 9ea2aa8

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

net/netfilter/nfnetlink.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -321,7 +321,8 @@ static void nfnetlink_rcv_batch(struct sk_buff *skb, struct nlmsghdr *nlh,
321321
nlh = nlmsg_hdr(skb);
322322
err = 0;
323323

324-
if (nlh->nlmsg_len < NLMSG_HDRLEN) {
324+
if (nlmsg_len(nlh) < sizeof(struct nfgenmsg) ||
325+
skb->len < nlh->nlmsg_len) {
325326
err = -EINVAL;
326327
goto ack;
327328
}

0 commit comments

Comments
 (0)