Skip to content

Commit

Permalink
fixup: sctp: verify size of a new chunk in _sctp_make_chunk()
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Greg Kroah-Hartman committed Mar 18, 2018
1 parent 502319c commit d8930f1
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion net/sctp/sm_make_chunk.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down

0 comments on commit d8930f1

Please sign in to comment.