summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorpeter <peter@FreeBSD.org>1996-08-12 14:00:26 +0000
committerpeter <peter@FreeBSD.org>1996-08-12 14:00:26 +0000
commitc2fcbeb6ff1e38452f855641439831a4746ef02a (patch)
tree5ef6d941ce8ca2df8701e926198d01206fc35900 /lib
parent633999a94babb0ab1ca53d9f3c8d9d8d70423752 (diff)
downloadFreeBSD-src-c2fcbeb6ff1e38452f855641439831a4746ef02a.zip
FreeBSD-src-c2fcbeb6ff1e38452f855641439831a4746ef02a.tar.gz
clear various struct sockaddr_in's on stack, set sin_len.
(Noticed when comparing to OpenBSD source)
Diffstat (limited to 'lib')
-rw-r--r--lib/libc/rpc/clnt_generic.c4
-rw-r--r--lib/libc/rpc/clnt_simple.c4
-rw-r--r--lib/libc/rpc/getrpcport.c4
-rw-r--r--lib/libc/rpc/pmap_rmt.c3
-rw-r--r--lib/libc/rpc/svc.c3
-rw-r--r--lib/libc/rpc/svc_tcp.c3
-rw-r--r--lib/libc/rpc/svc_udp.c3
7 files changed, 17 insertions, 7 deletions
diff --git a/lib/libc/rpc/clnt_generic.c b/lib/libc/rpc/clnt_generic.c
index a529336..44b9f79 100644
--- a/lib/libc/rpc/clnt_generic.c
+++ b/lib/libc/rpc/clnt_generic.c
@@ -30,7 +30,7 @@
#if defined(LIBC_SCCS) && !defined(lint)
/*static char *sccsid = "from: @(#)clnt_generic.c 1.4 87/08/11 (C) 1987 SMI";*/
/*static char *sccsid = "from: @(#)clnt_generic.c 2.2 88/08/01 4.0 RPCSRC";*/
-static char *rcsid = "$Id: clnt_generic.c,v 1.2 1995/05/30 05:41:14 rgrimes Exp $";
+static char *rcsid = "$Id: clnt_generic.c,v 1.3 1995/10/22 14:51:12 phk Exp $";
#endif
/*
@@ -74,6 +74,8 @@ clnt_create(hostname, prog, vers, proto)
rpc_createerr.cf_error.re_errno = EAFNOSUPPORT;
return (NULL);
}
+ memset(&sin, 0, sizeof(sin));
+ sin.sin_len = sizeof(struct sockaddr_in);
sin.sin_family = h->h_addrtype;
sin.sin_port = 0;
bzero(sin.sin_zero, sizeof(sin.sin_zero));
diff --git a/lib/libc/rpc/clnt_simple.c b/lib/libc/rpc/clnt_simple.c
index 5dfbc22..5d24b85 100644
--- a/lib/libc/rpc/clnt_simple.c
+++ b/lib/libc/rpc/clnt_simple.c
@@ -30,7 +30,7 @@
#if defined(LIBC_SCCS) && !defined(lint)
/*static char *sccsid = "from: @(#)clnt_simple.c 1.35 87/08/11 Copyr 1984 Sun Micro";*/
/*static char *sccsid = "from: @(#)clnt_simple.c 2.2 88/08/01 4.0 RPCSRC";*/
-static char *rcsid = "$Id: clnt_simple.c,v 1.3 1995/10/22 14:51:17 phk Exp $";
+static char *rcsid = "$Id: clnt_simple.c,v 1.4 1996/06/10 20:13:03 jraynard Exp $";
#endif
/*
@@ -93,7 +93,9 @@ int callrpc(host, prognum, versnum, procnum, inproc, in, outproc, out)
return ((int) RPC_UNKNOWNHOST);
timeout.tv_usec = 0;
timeout.tv_sec = 5;
+ memset(&server_addr, 0, sizeof(server_addr));
bcopy(hp->h_addr, (char *)&server_addr.sin_addr, hp->h_length);
+ server_addr.sin_len = sizeof(struct sockaddr_in);
server_addr.sin_family = AF_INET;
server_addr.sin_port = 0;
if ((crp->client = clntudp_create(&server_addr, (u_long)prognum,
diff --git a/lib/libc/rpc/getrpcport.c b/lib/libc/rpc/getrpcport.c
index 5c54473..91af220 100644
--- a/lib/libc/rpc/getrpcport.c
+++ b/lib/libc/rpc/getrpcport.c
@@ -30,7 +30,7 @@
#if defined(LIBC_SCCS) && !defined(lint)
/*static char *sccsid = "from: @(#)getrpcport.c 1.3 87/08/11 SMI";*/
/*static char *sccsid = "from: @(#)getrpcport.c 2.1 88/07/29 4.0 RPCSRC";*/
-static char *rcsid = "$Id: getrpcport.c,v 1.3 1995/10/22 14:51:26 phk Exp $";
+static char *rcsid = "$Id: getrpcport.c,v 1.4 1996/06/08 22:54:52 jraynard Exp $";
#endif
/*
@@ -54,7 +54,9 @@ int getrpcport(host, prognum, versnum, proto)
if ((hp = gethostbyname(host)) == NULL)
return (0);
+ memset(&addr, 0, sizeof(addr));
bcopy(hp->h_addr, (char *) &addr.sin_addr, hp->h_length);
+ addr.sin_len = sizeof(struct sockaddr_in);
addr.sin_family = AF_INET;
addr.sin_port = 0;
return (pmap_getport(&addr, prognum, versnum, proto));
diff --git a/lib/libc/rpc/pmap_rmt.c b/lib/libc/rpc/pmap_rmt.c
index 31d5e97..b8cc248 100644
--- a/lib/libc/rpc/pmap_rmt.c
+++ b/lib/libc/rpc/pmap_rmt.c
@@ -30,7 +30,7 @@
#if defined(LIBC_SCCS) && !defined(lint)
/*static char *sccsid = "from: @(#)pmap_rmt.c 1.21 87/08/27 Copyr 1984 Sun Micro";*/
/*static char *sccsid = "from: @(#)pmap_rmt.c 2.2 88/08/01 4.0 RPCSRC";*/
-static char *rcsid = "$Id: pmap_rmt.c,v 1.6 1996/06/10 00:49:17 jraynard Exp $";
+static char *rcsid = "$Id: pmap_rmt.c,v 1.7 1996/06/10 04:59:05 wpaul Exp $";
#endif
/*
@@ -285,6 +285,7 @@ clnt_broadcast(prog, vers, proc, xargs, argsp, xresults, resultsp, eachresult)
#endif /* def FD_SETSIZE */
nets = getbroadcastnets(addrs, sock, inbuf);
bzero((char *)&baddr, sizeof (baddr));
+ baddr.sin_len = sizeof(struct sockaddr_in);
baddr.sin_family = AF_INET;
baddr.sin_port = htons(PMAPPORT);
baddr.sin_addr.s_addr = htonl(INADDR_ANY);
diff --git a/lib/libc/rpc/svc.c b/lib/libc/rpc/svc.c
index 06c0609..05f82d3 100644
--- a/lib/libc/rpc/svc.c
+++ b/lib/libc/rpc/svc.c
@@ -30,7 +30,7 @@
#if defined(LIBC_SCCS) && !defined(lint)
/*static char *sccsid = "from: @(#)svc.c 1.44 88/02/08 Copyr 1984 Sun Micro";*/
/*static char *sccsid = "from: @(#)svc.c 2.4 88/08/11 4.0 RPCSRC";*/
-static char *rcsid = "$Id: svc.c,v 1.4 1996/06/10 00:49:18 jraynard Exp $";
+static char *rcsid = "$Id: svc.c,v 1.5 1996/06/11 17:22:50 jraynard Exp $";
#endif
/*
@@ -92,6 +92,7 @@ xprt_register(xprt)
if (xports == NULL) {
xports = (SVCXPRT **)
mem_alloc(FD_SETSIZE * sizeof(SVCXPRT *));
+ memset(xports, 0, FD_SETSIZE * sizeof(SVCXPRT *));
}
if (sock < _rpc_dtablesize()) {
xports[sock] = xprt;
diff --git a/lib/libc/rpc/svc_tcp.c b/lib/libc/rpc/svc_tcp.c
index 2b941ba..05193b3 100644
--- a/lib/libc/rpc/svc_tcp.c
+++ b/lib/libc/rpc/svc_tcp.c
@@ -30,7 +30,7 @@
#if defined(LIBC_SCCS) && !defined(lint)
/*static char *sccsid = "from: @(#)svc_tcp.c 1.21 87/08/11 Copyr 1984 Sun Micro";*/
/*static char *sccsid = "from: @(#)svc_tcp.c 2.2 88/08/01 4.0 RPCSRC";*/
-static char *rcsid = "$Id: svc_tcp.c,v 1.5 1996/06/08 22:54:57 jraynard Exp $";
+static char *rcsid = "$Id: svc_tcp.c,v 1.6 1996/06/10 20:13:09 jraynard Exp $";
#endif
/*
@@ -143,6 +143,7 @@ svctcp_create(sock, sendsize, recvsize)
madesock = TRUE;
}
bzero((char *)&addr, sizeof (addr));
+ addr.sin_len = sizeof(struct sockaddr_in);
addr.sin_family = AF_INET;
if (bindresvport(sock, &addr)) {
addr.sin_port = 0;
diff --git a/lib/libc/rpc/svc_udp.c b/lib/libc/rpc/svc_udp.c
index 2b0ca61..16a6140 100644
--- a/lib/libc/rpc/svc_udp.c
+++ b/lib/libc/rpc/svc_udp.c
@@ -30,7 +30,7 @@
#if defined(LIBC_SCCS) && !defined(lint)
/*static char *sccsid = "from: @(#)svc_udp.c 1.24 87/08/11 Copyr 1984 Sun Micro";*/
/*static char *sccsid = "from: @(#)svc_udp.c 2.2 88/07/29 4.0 RPCSRC";*/
-static char *rcsid = "$Id: svc_udp.c,v 1.4 1995/10/22 14:51:39 phk Exp $";
+static char *rcsid = "$Id: svc_udp.c,v 1.5 1996/06/08 22:54:59 jraynard Exp $";
#endif
/*
@@ -114,6 +114,7 @@ svcudp_bufcreate(sock, sendsz, recvsz)
madesock = TRUE;
}
bzero((char *)&addr, sizeof (addr));
+ addr.sin_len = sizeof(struct sockaddr_in);
addr.sin_family = AF_INET;
if (bindresvport(sock, &addr)) {
addr.sin_port = 0;
OpenPOWER on IntegriCloud