sctp: fix the length check in sctp_getsockopt_maxburst()
Subsystems (2)
PATCH 1/1 sctp: fix the length check in sctp_getsockopt_maxburst()
The code in sctp_getsockopt_maxburst() doesn't allow len to be larger then struct sctp_assoc_value, which is a common case where app writers just pass down the sizeof(buf) or something similar.
This patch fix the problem.
Signed-off-by Wei Yongjun <[email protected]>
--- net/sctp/socket.c | 3 ++- 1 files changed, 2 insertions(+), 1 deletions(-)
net/sctp/socket.c +2 -1
@@ -5287,7 +5287,8 @@ static int sctp_getsockopt_maxburst(struct sock *sk, int len,printk (KERN_WARNING "SCTP: Use struct sctp_assoc_value instead\n" ); params.assoc_id =0 ; - }else if (len =sizeof (struct sctp_assoc_value )) { + }else if (len >=sizeof (struct sctp_assoc_value )) { + len =sizeof (struct sctp_assoc_value );if (copy_from_user (¶ms, optval, len))return -EFAULT ; }else
Signature · 1 line
1.5.3.8