summaryrefslogtreecommitdiffstats
path: root/sys/netinet/sctputil.c
diff options
context:
space:
mode:
authorrrs <rrs@FreeBSD.org>2007-09-21 04:19:33 +0000
committerrrs <rrs@FreeBSD.org>2007-09-21 04:19:33 +0000
commit66d80bdf9359351cec7c1c27da2d4b221d62e82a (patch)
tree502fb7dd0133fb0298ac0f19520082c5b82ac608 /sys/netinet/sctputil.c
parent275d99eb1a004b5f3c2de64ef6ae613365f9cbc4 (diff)
downloadFreeBSD-src-66d80bdf9359351cec7c1c27da2d4b221d62e82a.zip
FreeBSD-src-66d80bdf9359351cec7c1c27da2d4b221d62e82a.tar.gz
- fix (global) address handling in the presence of duplicates, the
last interface should own the address, but the current code fumbles the handoff. This fixes that. - move address related debugs to PCB4 and add additional ones to help in debugging address problems. Approved by: re@freebsd.org (K Smith)
Diffstat (limited to 'sys/netinet/sctputil.c')
-rw-r--r--sys/netinet/sctputil.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/sys/netinet/sctputil.c b/sys/netinet/sctputil.c
index 7587b1a..19cb066 100644
--- a/sys/netinet/sctputil.c
+++ b/sys/netinet/sctputil.c
@@ -4935,6 +4935,10 @@ sctp_sorecvmsg(struct socket *so,
SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTPUTIL, EINVAL);
return (EINVAL);
}
+ if (from && fromlen <= 0) {
+ SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTPUTIL, EINVAL);
+ return (EINVAL);
+ }
if (msg_flags) {
in_flags = *msg_flags;
if (in_flags & MSG_PEEK)
@@ -5362,12 +5366,12 @@ found_one:
struct sockaddr *to;
#ifdef INET
- cp_len = min(fromlen, control->whoFrom->ro._l_addr.sin.sin_len);
+ cp_len = min((size_t)fromlen, (size_t)control->whoFrom->ro._l_addr.sin.sin_len);
memcpy(from, &control->whoFrom->ro._l_addr, cp_len);
((struct sockaddr_in *)from)->sin_port = control->port_from;
#else
/* No AF_INET use AF_INET6 */
- cp_len = min(fromlen, control->whoFrom->ro._l_addr.sin6.sin6_len);
+ cp_len = min((size_t)fromlen, (size_t)control->whoFrom->ro._l_addr.sin6.sin6_len);
memcpy(from, &control->whoFrom->ro._l_addr, cp_len);
((struct sockaddr_in6 *)from)->sin6_port = control->port_from;
#endif
OpenPOWER on IntegriCloud