summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authortuexen <tuexen@FreeBSD.org>2011-06-30 16:56:55 +0000
committertuexen <tuexen@FreeBSD.org>2011-06-30 16:56:55 +0000
commitdfe16c28d31c645525a5e0e55acb6dea785db786 (patch)
tree6b6bc05662ec3c2742f28a42b49a1819e6053e4e
parent2b9b009195e403f0f2fc9bf0d9eeefc2297d94b8 (diff)
downloadFreeBSD-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.
-rw-r--r--sys/netinet/sctp_uio.h1
-rw-r--r--sys/netinet/sctp_usrreq.c12
2 files changed, 12 insertions, 1 deletions
diff --git a/sys/netinet/sctp_uio.h b/sys/netinet/sctp_uio.h
index d3b186d..9b9acbf 100644
--- a/sys/netinet/sctp_uio.h
+++ b/sys/netinet/sctp_uio.h
@@ -591,6 +591,7 @@ struct sctp_authchunk {
struct sctp_authkey {
sctp_assoc_t sca_assoc_id;
uint16_t sca_keynumber;
+ uint16_t sca_keylength;
uint8_t sca_key[];
};
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;
OpenPOWER on IntegriCloud