Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 55958
b: refs/heads/master
c: 70b57b8
h: refs/heads/master
v: v3
  • Loading branch information
Vlad Yasevich authored and David S. Miller committed May 11, 2007
1 parent 7ba0a88 commit cb0dfe4
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 8dc4984a6bdcaf56cdb458a7338c32c16f32540c
refs/heads/master: 70b57b814ed5a93bf21d9dc5f8a7d23620a77e44
12 changes: 8 additions & 4 deletions trunk/net/sctp/socket.c
Original file line number Diff line number Diff line change
Expand Up @@ -4164,6 +4164,7 @@ static int sctp_getsockopt_local_addrs_old(struct sock *sk, int len,
rwlock_t *addr_lock;
int err = 0;
void *addrs;
void *buf;
int bytes_copied = 0;

if (len != sizeof(struct sctp_getaddrs_old))
Expand Down Expand Up @@ -4217,13 +4218,14 @@ static int sctp_getsockopt_local_addrs_old(struct sock *sk, int len,
}
}

buf = addrs;
list_for_each(pos, &bp->address_list) {
addr = list_entry(pos, struct sctp_sockaddr_entry, list);
memcpy(&temp, &addr->a, sizeof(temp));
sctp_get_pf_specific(sk->sk_family)->addr_v4map(sp, &temp);
addrlen = sctp_get_af_specific(temp.sa.sa_family)->sockaddr_len;
memcpy(addrs, &temp, addrlen);
to += addrlen;
memcpy(buf, &temp, addrlen);
buf += addrlen;
bytes_copied += addrlen;
cnt ++;
if (cnt >= getaddrs.addr_num) break;
Expand Down Expand Up @@ -4266,6 +4268,7 @@ static int sctp_getsockopt_local_addrs(struct sock *sk, int len,
size_t space_left;
int bytes_copied = 0;
void *addrs;
void *buf;

if (len <= sizeof(struct sctp_getaddrs))
return -EINVAL;
Expand Down Expand Up @@ -4316,6 +4319,7 @@ static int sctp_getsockopt_local_addrs(struct sock *sk, int len,
}
}

buf = addrs;
list_for_each(pos, &bp->address_list) {
addr = list_entry(pos, struct sctp_sockaddr_entry, list);
memcpy(&temp, &addr->a, sizeof(temp));
Expand All @@ -4325,8 +4329,8 @@ static int sctp_getsockopt_local_addrs(struct sock *sk, int len,
err = -ENOMEM; /*fixme: right error?*/
goto error;
}
memcpy(addrs, &temp, addrlen);
to += addrlen;
memcpy(buf, &temp, addrlen);
buf += addrlen;
bytes_copied += addrlen;
cnt ++;
space_left -= addrlen;
Expand Down

0 comments on commit cb0dfe4

Please sign in to comment.