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.
This commit is contained in:
Michael Tuexen 2011-06-30 16:56:55 +00:00
parent 9777aa3f12
commit b845acda75
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=223697
2 changed files with 12 additions and 1 deletions

View File

@ -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[];
};

View File

@ -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;