diff options
author | tuexen <tuexen@FreeBSD.org> | 2011-06-30 16:56:55 +0000 |
---|---|---|
committer | tuexen <tuexen@FreeBSD.org> | 2011-06-30 16:56:55 +0000 |
commit | dfe16c28d31c645525a5e0e55acb6dea785db786 (patch) | |
tree | 6b6bc05662ec3c2742f28a42b49a1819e6053e4e /sys/netinet/sctp_usrreq.c | |
parent | 2b9b009195e403f0f2fc9bf0d9eeefc2297d94b8 (diff) | |
download | FreeBSD-src-dfe16c28d31c645525a5e0e55acb6dea785db786.zip FreeBSD-src-dfe16c28d31c645525a5e0e55acb6dea785db786.tar.gz |
Add the missing sca_keylength field to the sctp_authkey structure,
which is used the the SCTP_AUTH_KEY socket option.
MFC after: 1 month.
Diffstat (limited to 'sys/netinet/sctp_usrreq.c')
-rw-r--r-- | sys/netinet/sctp_usrreq.c | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/sys/netinet/sctp_usrreq.c b/sys/netinet/sctp_usrreq.c index 4c1d726..ab87772 100644 --- a/sys/netinet/sctp_usrreq.c +++ b/sys/netinet/sctp_usrreq.c @@ -3571,8 +3571,18 @@ sctp_setopt(struct socket *so, int optname, void *optval, size_t optsize, size_t size; SCTP_CHECK_AND_CAST(sca, optval, struct sctp_authkey, optsize); + if (sca->sca_keylength == 0) { + size = optsize - sizeof(struct sctp_authkey); + } else { + if (sca->sca_keylength + sizeof(struct sctp_authkey) <= optsize) { + size = sca->sca_keylength; + } else { + SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_USRREQ, EINVAL); + error = EINVAL; + break; + } + } SCTP_FIND_STCB(inp, stcb, sca->sca_assoc_id); - size = optsize - sizeof(struct sctp_authkey); if (stcb) { shared_keys = &stcb->asoc.shared_keys; |