diff options
author | Alexander V. Chernikov <melifaro@FreeBSD.org> | 2023-02-18 17:15:25 +0000 |
---|---|---|
committer | Alexander V. Chernikov <melifaro@FreeBSD.org> | 2023-02-18 17:53:05 +0000 |
commit | 3f70fca90f9f1c6a40e55e6edd2dc1b1272f4998 (patch) | |
tree | d22c2ab8e4eba6c8b97d5a41c4e1790fbb701832 | |
parent | 1ea58b413595310de43587c609421ede74770f11 (diff) | |
download | src-3f70fca90f9f1c6a40e55e6edd2dc1b1272f4998.tar.gz src-3f70fca90f9f1c6a40e55e6edd2dc1b1272f4998.zip |
netlink: check result of sooptcopyin().
CID: 1498866
MFC after: 2 weeks
-rw-r--r-- | sys/netlink/netlink_domain.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/sys/netlink/netlink_domain.c b/sys/netlink/netlink_domain.c index 4d34fd381c39..630ce47cd228 100644 --- a/sys/netlink/netlink_domain.c +++ b/sys/netlink/netlink_domain.c @@ -612,7 +612,9 @@ nl_ctloutput(struct socket *so, struct sockopt *sopt) switch (sopt->sopt_name) { case NETLINK_ADD_MEMBERSHIP: case NETLINK_DROP_MEMBERSHIP: - sooptcopyin(sopt, &optval, sizeof(optval), sizeof(optval)); + error = sooptcopyin(sopt, &optval, sizeof(optval), sizeof(optval)); + if (error != 0) + break; if (optval <= 0 || optval >= NLP_MAX_GROUPS) { error = ERANGE; break; @@ -629,7 +631,9 @@ nl_ctloutput(struct socket *so, struct sockopt *sopt) case NETLINK_CAP_ACK: case NETLINK_EXT_ACK: case NETLINK_GET_STRICT_CHK: - sooptcopyin(sopt, &optval, sizeof(optval), sizeof(optval)); + error = sooptcopyin(sopt, &optval, sizeof(optval), sizeof(optval)); + if (error != 0) + break; flag = nl_getoptflag(sopt->sopt_name); |