mirror of
https://github.com/freebsd/freebsd-src.git
synced 2026-10-28 11:25:21 +01:00
netlink: Avoid undefined behaviour
Even though it is not dereferenced, it is UB to take the address of an out of bounds array element. Reviewed by: pouria, bz, des, adrian Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D57158
This commit is contained in:
1 parent
0b2df68367
commit
1a4ad649cb
1 file changed
+2
-2
@@ -127,13 +127,13 @@ genl_handle_message(struct nlmsghdr *hdr, struct nl_pstate *npt)
|
||||
}
|
||||
|
||||
family_id = hdr->nlmsg_type - GENL_MIN_ID;
|
||||
gf = &families[family_id];
|
||||
if (__predict_false(family_id >= MAX_FAMILIES ||
|
||||
gf->family_name == NULL)) {
|
||||
families[family_id].family_name == NULL)) {
|
||||
NLP_LOG(LOG_DEBUG, nlp, "invalid message type: %d",
|
||||
hdr->nlmsg_type);
|
||||
return (ENOTSUP);
|
||||
}
|
||||
gf = &families[family_id];
|
||||
|
||||
struct genlmsghdr *ghdr = (struct genlmsghdr *)(hdr + 1);
|
||||
|
||||
|
||||
Reference in new issue
Block a user