Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 7 Aug 2021 12:57:26 GMT
From:      Michael Tuexen <tuexen@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org
Subject:   git: b732091a761a - main - sctp: improve input validation of mapped addresses in send() Reported by:	syzbot+35528f275f2eea6317cc@syzkaller.appspotmail.com Reported by:	syzbot+ac29916d5f16d241553d@syzkaller.appspotmail.com MFC after:	3 days
Message-ID:  <202108071257.177CvQZp042846@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch main has been updated by tuexen:

URL: https://cgit.FreeBSD.org/src/commit/?id=b732091a761a04c7a04229f28642d27dc48485d8

commit b732091a761a04c7a04229f28642d27dc48485d8
Author:     Michael Tuexen <tuexen@FreeBSD.org>
AuthorDate: 2021-08-07 12:50:40 +0000
Commit:     Michael Tuexen <tuexen@FreeBSD.org>
CommitDate: 2021-08-07 12:50:40 +0000

    sctp: improve input validation of mapped addresses in send()
    Reported by:    syzbot+35528f275f2eea6317cc@syzkaller.appspotmail.com
    Reported by:    syzbot+ac29916d5f16d241553d@syzkaller.appspotmail.com
    MFC after:      3 days
---
 sys/netinet/sctp_output.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/sys/netinet/sctp_output.c b/sys/netinet/sctp_output.c
index e34534e80fa3..5e9aff7bfba9 100644
--- a/sys/netinet/sctp_output.c
+++ b/sys/netinet/sctp_output.c
@@ -12434,9 +12434,13 @@ sctp_sosend(struct socket *so,
 	}
 	addr_to_use = addr;
 #if defined(INET) && defined(INET6)
-	if ((addr) && (addr->sa_family == AF_INET6)) {
+	if ((addr != NULL) && (addr->sa_family == AF_INET6)) {
 		struct sockaddr_in6 *sin6;
 
+		if (addr->sa_len != sizeof(struct sockaddr_in6)) {
+			SCTP_LTRACE_ERR_RET(NULL, NULL, NULL, SCTP_FROM_SCTP_OUTPUT, EINVAL);
+			return (EINVAL);
+		}
 		sin6 = (struct sockaddr_in6 *)addr;
 		if (IN6_IS_ADDR_V4MAPPED(&sin6->sin6_addr)) {
 			in6_sin6_2_sin(&sin, sin6);



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202108071257.177CvQZp042846>