Author: tuexen
Date: Sat May  4 11:03:10 2019
New Revision: 347101
URL: https://svnweb.freebsd.org/changeset/base/347101

Log:
  MFC r344722:
  Use correct buffer sizes in sctp_get[lp]addrs().

Modified:
  stable/12/lib/libc/net/sctp_sys_calls.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/lib/libc/net/sctp_sys_calls.c
==============================================================================
--- stable/12/lib/libc/net/sctp_sys_calls.c     Sat May  4 11:01:31 2019        
(r347100)
+++ stable/12/lib/libc/net/sctp_sys_calls.c     Sat May  4 11:03:10 2019        
(r347101)
@@ -415,7 +415,7 @@ sctp_getpaddrs(int sd, sctp_assoc_t id, struct sockadd
                return (-1);
        }
        /* size required is returned in 'asoc' */
-       opt_len = (socklen_t) ((size_t)asoc + sizeof(struct sctp_getaddresses));
+       opt_len = (socklen_t) ((size_t)asoc + sizeof(sctp_assoc_t));
        addrs = calloc(1, (size_t)opt_len);
        if (addrs == NULL) {
                errno = ENOMEM;
@@ -475,9 +475,7 @@ sctp_getladdrs(int sd, sctp_assoc_t id, struct sockadd
                errno = ENOTCONN;
                return (-1);
        }
-       opt_len = (socklen_t) (size_of_addresses +
-           sizeof(struct sockaddr_storage) +
-           sizeof(struct sctp_getaddresses));
+       opt_len = (socklen_t) (size_of_addresses + sizeof(sctp_assoc_t));
        addrs = calloc(1, (size_t)opt_len);
        if (addrs == NULL) {
                errno = ENOMEM;
_______________________________________________
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to