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;
_______________________________________________
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to