diff options
author | rrs <rrs@FreeBSD.org> | 2007-06-22 13:59:54 +0000 |
---|---|---|
committer | rrs <rrs@FreeBSD.org> | 2007-06-22 13:59:54 +0000 |
commit | 689929ef2e024d9912f76db5d23e2e2aaa68e39a (patch) | |
tree | ca8a4dceb9abd347c0fb2864fa95744518377b5a /lib/libc | |
parent | cdfbc0147192329ec8c28c33e01dc1ba04756b5a (diff) | |
download | FreeBSD-src-689929ef2e024d9912f76db5d23e2e2aaa68e39a.zip FreeBSD-src-689929ef2e024d9912f76db5d23e2e2aaa68e39a.tar.gz |
- Fix incorrect error return on sctp_getaddrlen
- Fix a memory leak when a non v4/v6 address was passed in.
- Take out strange line that copy's back to the src array
incorrectly (corrupting the input array).
Approved by: re(bmah@freebsd.org)
Obtained from: Weongyo Jeong(weongyo.jeong@gmail.com)
Diffstat (limited to 'lib/libc')
-rw-r--r-- | lib/libc/net/sctp_sys_calls.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/libc/net/sctp_sys_calls.c b/lib/libc/net/sctp_sys_calls.c index 18f39c1..c63466a 100644 --- a/lib/libc/net/sctp_sys_calls.c +++ b/lib/libc/net/sctp_sys_calls.c @@ -152,14 +152,14 @@ sctp_getaddrlen(sa_family_t family) sd = socket(AF_INET6, SOCK_SEQPACKET, IPPROTO_SCTP); #endif if (sd == -1) { - return (errno); + return (-1); } error = getsockopt(sd, IPPROTO_SCTP, SCTP_GET_ADDR_LEN, &av, &siz); close(sd); if (error == 0) { return ((int)av.assoc_value); } else { - return (error); + return (-1); } } @@ -256,8 +256,8 @@ sctp_bindx(int sd, struct sockaddr *addrs, int addrcnt, int flags) for (i = 0; i < addrcnt; i++) { sz = sa->sa_len; fam = sa->sa_family; - ((struct sockaddr_in *)&addrs[i])->sin_port = ((struct sockaddr_in *)sa)->sin_port; if ((fam != AF_INET) && (fam != AF_INET6)) { + free(gaddrs); errno = EINVAL; return (-1); } |