summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authortuexen <tuexen@FreeBSD.org>2014-10-12 17:39:37 +0000
committertuexen <tuexen@FreeBSD.org>2014-10-12 17:39:37 +0000
commit85569fa02c3eacfedb0cf0a7c4a912fd9895d3b2 (patch)
tree69a739bafd1e496772fa261e457073c5841b9892
parent4f377875d1bf95ab3bfcd38b7f1620a2f9d0d144 (diff)
downloadFreeBSD-src-85569fa02c3eacfedb0cf0a7c4a912fd9895d3b2.zip
FreeBSD-src-85569fa02c3eacfedb0cf0a7c4a912fd9895d3b2.tar.gz
MFC r272750:
Ensure that the number of stream reported in srs_number_streams is consistent with the amount of data provided in the SCTP_RESET_STREAMS socket option. Thanks to Peter Bostroem from Google for drawing my attention to this part of the code.
-rw-r--r--sys/netinet/sctp_usrreq.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/sys/netinet/sctp_usrreq.c b/sys/netinet/sctp_usrreq.c
index e1fa351..e1ad178 100644
--- a/sys/netinet/sctp_usrreq.c
+++ b/sys/netinet/sctp_usrreq.c
@@ -4431,6 +4431,12 @@ sctp_setopt(struct socket *so, int optname, void *optval, size_t optsize,
SCTP_TCB_UNLOCK(stcb);
break;
}
+ if (sizeof(struct sctp_reset_streams) +
+ strrst->srs_number_streams * sizeof(uint16_t) > optsize) {
+ error = EINVAL;
+ SCTP_TCB_UNLOCK(stcb);
+ break;
+ }
if (stcb->asoc.stream_reset_outstanding) {
SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_USRREQ, EALREADY);
error = EALREADY;
OpenPOWER on IntegriCloud