diff options
author | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2018-03-13 10:56:00 +0100 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2018-03-18 11:15:45 +0100 |
commit | d8930f132b54a3abf0d12d506e9e9204ce23abb8 (patch) | |
tree | 2751b1692771196fdf039bb579522018e2ad7294 | |
parent | 502319ce91249e578323190ee7332c8b43ca9202 (diff) |
fixup: sctp: verify size of a new chunk in _sctp_make_chunk()
Ben writes:
> > + int chunklen;
> > +
> > + chunklen = sizeof(*chunk_hdr) + paylen;
>
> I think this length still needs to be rounded up (with WORD_ROUND here,
> instead of SCTP_PAD4 upstream).
So here's a fix for this problem.
Reported-by: Ben Hutchings <ben.hutchings@codethink.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r-- | net/sctp/sm_make_chunk.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/net/sctp/sm_make_chunk.c b/net/sctp/sm_make_chunk.c index 6d48cbf6465d..bbf6abb6ae3c 100644 --- a/net/sctp/sm_make_chunk.c +++ b/net/sctp/sm_make_chunk.c @@ -1369,7 +1369,7 @@ static struct sctp_chunk *_sctp_make_chunk(const struct sctp_association *asoc, struct sock *sk; int chunklen; - chunklen = sizeof(*chunk_hdr) + paylen; + chunklen = WORD_ROUND(sizeof(*chunk_hdr) + paylen); if (chunklen > SCTP_MAX_CHUNK_LEN) goto nodata; |