git: bbe6559cf958 - main - netlink: fix size comparison
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Sat, 11 Jan 2025 05:00:27 UTC
The branch main has been updated by glebius: URL: https://cgit.FreeBSD.org/src/commit/?id=bbe6559cf958a9016cb18ff1833ebd3a884f349f commit bbe6559cf958a9016cb18ff1833ebd3a884f349f Author: Gleb Smirnoff <glebius@FreeBSD.org> AuthorDate: 2025-01-11 04:57:55 +0000 Commit: Gleb Smirnoff <glebius@FreeBSD.org> CommitDate: 2025-01-11 04:57:55 +0000 netlink: fix size comparison We want to check the size of the header, not a pointer to it. Reviewed by: melifaro, markj Differential Revision: https://reviews.freebsd.org/D48309 --- sys/netlink/netlink_generic.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sys/netlink/netlink_generic.c b/sys/netlink/netlink_generic.c index 623531492173..b78ab80ab3c2 100644 --- a/sys/netlink/netlink_generic.c +++ b/sys/netlink/netlink_generic.c @@ -67,7 +67,8 @@ genl_handle_message(struct nlmsghdr *hdr, struct nl_pstate *npt) return (ENOTSUP); } - if (__predict_false(hdr->nlmsg_len < sizeof(hdr) + GENL_HDRLEN)) { + if (__predict_false(hdr->nlmsg_len < sizeof(struct nlmsghdr) + + GENL_HDRLEN)) { NLP_LOG(LOG_DEBUG, nlp, "invalid message size: %d", hdr->nlmsg_len); return (EINVAL); }