Report the correct length when using the IPPROTO_SCTP level

socket options SCTP_GET_PEER_ADDRESSES and SCTP_GET_LOCAL_ADDRESSES.
This commit is contained in:
Michael Tuexen 2019-03-02 13:12:37 +00:00
parent bd0eb4dcc4
commit e57d481c5e

View File

@ -2240,8 +2240,8 @@ sctp_getopt(struct socket *so, int optname, void *optval, size_t *optsize,
SCTP_FIND_STCB(inp, stcb, saddr->sget_assoc_id);
if (stcb) {
left = (*optsize) - sizeof(struct sctp_getaddresses);
*optsize = sizeof(struct sctp_getaddresses);
left = (*optsize) - sizeof(sctp_assoc_t);
*optsize = sizeof(sctp_assoc_t);
sas = (struct sockaddr_storage *)&saddr->addr[0];
TAILQ_FOREACH(net, &stcb->asoc.nets, sctp_next) {
@ -2315,7 +2315,7 @@ sctp_getopt(struct socket *so, int optname, void *optval, size_t *optsize,
if (stcb) {
SCTP_TCB_UNLOCK(stcb);
}
*optsize = sizeof(struct sockaddr_storage) + actual;
*optsize = sizeof(sctp_assoc_t) + actual;
break;
}
case SCTP_PEER_ADDR_PARAMS: