1
0
mirror of https://git.FreeBSD.org/src.git synced 2024-12-22 11:17:19 +00:00

Use correct buffer sizes in sctp_get[lp]addrs().

MFC after:		3 days
This commit is contained in:
Michael Tuexen 2019-03-02 13:16:01 +00:00
parent e57d481c5e
commit 8124c05f2c
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=344722

View File

@ -415,7 +415,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;
@ -475,9 +475,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;