Use correct buffer sizes in sctp_get[lp]addrs().
MFC after: 3 days
This commit is contained in:
parent
e57d481c5e
commit
8124c05f2c
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=344722
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user