git: 112899c6afc5 - main - sctp: improve input validation of mapped addresses in sctp_connectx() MFC after: 3 days

Michael Tuexen tuexen at FreeBSD.org
Sat Aug 7 13:13:42 UTC 2021


The branch main has been updated by tuexen:

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

commit 112899c6afc5d174445b6ab4738b8eb4de19d835
Author:     Michael Tuexen <tuexen at FreeBSD.org>
AuthorDate: 2021-08-07 13:12:09 +0000
Commit:     Michael Tuexen <tuexen at FreeBSD.org>
CommitDate: 2021-08-07 13:12:09 +0000

    sctp: improve input validation of mapped addresses in sctp_connectx()
    MFC after:      3 days
---
 sys/netinet/sctputil.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/sys/netinet/sctputil.c b/sys/netinet/sctputil.c
index ad4409f666df..f331fb70ded5 100644
--- a/sys/netinet/sctputil.c
+++ b/sys/netinet/sctputil.c
@@ -6716,15 +6716,15 @@ sctp_connectx_helper_find(struct sctp_inpcb *inp, struct sockaddr *addr,
 			{
 				struct sockaddr_in6 *sin6;
 
+				incr = (unsigned int)sizeof(struct sockaddr_in6);
+				if (sa->sa_len != incr) {
+					return (EINVAL);
+				}
 				sin6 = (struct sockaddr_in6 *)sa;
 				if (IN6_IS_ADDR_V4MAPPED(&sin6->sin6_addr)) {
 					/* Must be non-mapped for connectx */
 					return (EINVAL);
 				}
-				incr = (unsigned int)sizeof(struct sockaddr_in6);
-				if (sa->sa_len != incr) {
-					return (EINVAL);
-				}
 				(*num_v6) += 1;
 				break;
 			}


More information about the dev-commits-src-all mailing list