git: 3f70fca90f9f - main - netlink: check result of sooptcopyin().
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Sat, 18 Feb 2023 17:55:01 UTC
The branch main has been updated by melifaro: URL: https://cgit.FreeBSD.org/src/commit/?id=3f70fca90f9f1c6a40e55e6edd2dc1b1272f4998 commit 3f70fca90f9f1c6a40e55e6edd2dc1b1272f4998 Author: Alexander V. Chernikov <melifaro@FreeBSD.org> AuthorDate: 2023-02-18 17:15:25 +0000 Commit: Alexander V. Chernikov <melifaro@FreeBSD.org> CommitDate: 2023-02-18 17:53:05 +0000 netlink: check result of sooptcopyin(). CID: 1498866 MFC after: 2 weeks --- sys/netlink/netlink_domain.c | 8 ++++++-- 1 file 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);