From 87f486b6bd9e91ce395fbf0b970c628974d0701d Mon Sep 17 00:00:00 2001 From: tuexen Date: Thu, 16 May 2019 09:03:48 +0000 Subject: [PATCH] MFC r344722: Use correct buffer sizes in sctp_get[lp]addrs(). --- lib/libc/net/sctp_sys_calls.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/lib/libc/net/sctp_sys_calls.c b/lib/libc/net/sctp_sys_calls.c index 25b9ec87d19..5201e7059a7 100644 --- a/lib/libc/net/sctp_sys_calls.c +++ b/lib/libc/net/sctp_sys_calls.c @@ -413,7 +413,7 @@ sctp_getpaddrs(int sd, sctp_assoc_t id, struct sockaddr **raddrs) 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; @@ -473,9 +473,7 @@ sctp_getladdrs(int sd, sctp_assoc_t id, struct sockaddr **raddrs) 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; -- 2.45.0