Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 10 Feb 2012 22:19:08 +0000 (UTC)
From:      Michael Tuexen <tuexen@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org
Subject:   svn commit: r231451 - stable/8/sys/netinet
Message-ID:  <201202102219.q1AMJ8pK098374@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: tuexen
Date: Fri Feb 10 22:19:07 2012
New Revision: 231451
URL: http://svn.freebsd.org/changeset/base/231451

Log:
  MFC r223697:
  Add the missing sca_keylength field to the sctp_authkey structure,
  which is used the the SCTP_AUTH_KEY socket option.

Modified:
  stable/8/sys/netinet/sctp_uio.h
  stable/8/sys/netinet/sctp_usrreq.c
Directory Properties:
  stable/8/sys/   (props changed)
  stable/8/sys/amd64/include/xen/   (props changed)
  stable/8/sys/boot/   (props changed)
  stable/8/sys/cddl/contrib/opensolaris/   (props changed)
  stable/8/sys/contrib/dev/acpica/   (props changed)
  stable/8/sys/contrib/pf/   (props changed)
  stable/8/sys/dev/e1000/   (props changed)

Modified: stable/8/sys/netinet/sctp_uio.h
==============================================================================
--- stable/8/sys/netinet/sctp_uio.h	Fri Feb 10 22:16:52 2012	(r231450)
+++ stable/8/sys/netinet/sctp_uio.h	Fri Feb 10 22:19:07 2012	(r231451)
@@ -591,6 +591,7 @@ struct sctp_authchunk {
 struct sctp_authkey {
 	sctp_assoc_t sca_assoc_id;
 	uint16_t sca_keynumber;
+	uint16_t sca_keylength;
 	uint8_t sca_key[];
 };
 

Modified: stable/8/sys/netinet/sctp_usrreq.c
==============================================================================
--- stable/8/sys/netinet/sctp_usrreq.c	Fri Feb 10 22:16:52 2012	(r231450)
+++ stable/8/sys/netinet/sctp_usrreq.c	Fri Feb 10 22:19:07 2012	(r231451)
@@ -3562,8 +3562,18 @@ sctp_setopt(struct socket *so, int optna
 			size_t size;
 
 			SCTP_CHECK_AND_CAST(sca, optval, struct sctp_authkey, optsize);
+			if (sca->sca_keylength == 0) {
+				size = optsize - sizeof(struct sctp_authkey);
+			} else {
+				if (sca->sca_keylength + sizeof(struct sctp_authkey) <= optsize) {
+					size = sca->sca_keylength;
+				} else {
+					SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_USRREQ, EINVAL);
+					error = EINVAL;
+					break;
+				}
+			}
 			SCTP_FIND_STCB(inp, stcb, sca->sca_assoc_id);
-			size = optsize - sizeof(struct sctp_authkey);
 
 			if (stcb) {
 				shared_keys = &stcb->asoc.shared_keys;



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