netlink: fix OOB read in genetlink

CID:		1498863
MFC after:	1 day

(cherry picked from commit 8f7455a926)
This commit is contained in:
Alexander V. Chernikov 2023-02-18 17:24:59 +00:00
parent 4c1ef49999
commit d9d596bb2c

View File

@ -267,7 +267,7 @@ genl_handle_message(struct nlmsghdr *hdr, struct nl_pstate *npt)
int family_id = (int)hdr->nlmsg_type - GENL_MIN_ID;
if (__predict_false(family_id < 0 || family_id > MAX_FAMILIES)) {
if (__predict_false(family_id < 0 || family_id >= MAX_FAMILIES)) {
NLP_LOG(LOG_DEBUG, nlp, "invalid message type: %d", hdr->nlmsg_type);
return (ENOTSUP);
}