diff options
Diffstat (limited to 'net/sctp/socket.c')
-rw-r--r-- | net/sctp/socket.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/net/sctp/socket.c b/net/sctp/socket.c index 06b42b7f5a02..92ba71dfe080 100644 --- a/net/sctp/socket.c +++ b/net/sctp/socket.c | |||
@@ -4133,9 +4133,10 @@ static int sctp_getsockopt_disable_fragments(struct sock *sk, int len, | |||
4133 | static int sctp_getsockopt_events(struct sock *sk, int len, char __user *optval, | 4133 | static int sctp_getsockopt_events(struct sock *sk, int len, char __user *optval, |
4134 | int __user *optlen) | 4134 | int __user *optlen) |
4135 | { | 4135 | { |
4136 | if (len < sizeof(struct sctp_event_subscribe)) | 4136 | if (len <= 0) |
4137 | return -EINVAL; | 4137 | return -EINVAL; |
4138 | len = sizeof(struct sctp_event_subscribe); | 4138 | if (len > sizeof(struct sctp_event_subscribe)) |
4139 | len = sizeof(struct sctp_event_subscribe); | ||
4139 | if (put_user(len, optlen)) | 4140 | if (put_user(len, optlen)) |
4140 | return -EFAULT; | 4141 | return -EFAULT; |
4141 | if (copy_to_user(optval, &sctp_sk(sk)->subscribe, len)) | 4142 | if (copy_to_user(optval, &sctp_sk(sk)->subscribe, len)) |