Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 22 Feb 2022 22:29:30 GMT
From:      Michael Tuexen <tuexen@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org
Subject:   git: 946fc2cb7320 - stable/13 - sctp: improve input validation of mapped addresses in send() Reported by:	syzbot+35528f275f2eea6317cc@syzkaller.appspotmail.com Reported by:	syzbot+ac29916d5f16d241553d@syzkaller.appspotmail.com
Message-ID:  <202202222229.21MMTUd5027756@gitrepo.freebsd.org>

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

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

commit 946fc2cb73209033ca823cba8fda0b6177815ebe
Author:     Michael Tuexen <tuexen@FreeBSD.org>
AuthorDate: 2021-08-07 12:50:40 +0000
Commit:     Michael Tuexen <tuexen@FreeBSD.org>
CommitDate: 2022-02-22 22:28:53 +0000

    sctp: improve input validation of mapped addresses in send()
    Reported by:    syzbot+35528f275f2eea6317cc@syzkaller.appspotmail.com
    Reported by:    syzbot+ac29916d5f16d241553d@syzkaller.appspotmail.com
    
    (cherry picked from commit b732091a761a04c7a04229f28642d27dc48485d8)
---
 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 786e9240b636..0f4ddd40753c 100644
--- a/sys/netinet/sctp_output.c
+++ b/sys/netinet/sctp_output.c
@@ -12449,9 +12449,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?202202222229.21MMTUd5027756>