From 6985aeab5eb448b018be0ecb043c3891ef8bd7b9 Mon Sep 17 00:00:00 2001 From: tuexen Date: Thu, 16 May 2019 09:22:37 +0000 Subject: [PATCH] MFC r345465: Fix a signed/unsigned bug when receiving SCTP messages. This is joint work with rrs@. --- sys/netinet/sctputil.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/sys/netinet/sctputil.c b/sys/netinet/sctputil.c index 64d17535e9a..2b4738bc9ab 100644 --- a/sys/netinet/sctputil.c +++ b/sys/netinet/sctputil.c @@ -5215,8 +5215,9 @@ sctp_sorecvmsg(struct socket *so, * */ struct sctp_inpcb *inp = NULL; - int my_len = 0; - int cp_len = 0, error = 0; + size_t my_len = 0; + size_t cp_len = 0; + int error = 0; struct sctp_queued_to_read *control = NULL, *ctl = NULL, *nxt = NULL; struct mbuf *m = NULL; struct sctp_tcb *stcb = NULL; @@ -5724,8 +5725,8 @@ sctp_sorecvmsg(struct socket *so, m = control->data; while (m) { /* Move out all we can */ - cp_len = (int)uio->uio_resid; - my_len = (int)SCTP_BUF_LEN(m); + cp_len = uio->uio_resid; + my_len = SCTP_BUF_LEN(m); if (cp_len > my_len) { /* not enough in this buf */ cp_len = my_len; -- 2.45.0