should bzero automatic sockaddr's before use

This commit is contained in:
deraadt 1993-12-05 14:36:48 +00:00
parent b7a74adfed
commit f92ccee2e2
4 changed files with 9 additions and 6 deletions

View File

@ -33,7 +33,7 @@
#if defined(LIBC_SCCS) && !defined(lint)
/*static char *sccsid = "from: @(#)rcmd.c 5.24 (Berkeley) 2/24/91";*/
static char *rcsid = "$Id: rcmd.c,v 1.3 1993/08/26 00:46:13 jtc Exp $";
static char *rcsid = "$Id: rcmd.c,v 1.4 1993/12/05 14:42:26 deraadt Exp $";
#endif /* LIBC_SCCS and not lint */
#include <sys/param.h>
@ -59,7 +59,7 @@ rcmd(ahost, rport, locuser, remuser, cmd, fd2p)
{
int s, timo = 1, pid;
long oldmask;
struct sockaddr_in sin, sin2, from;
struct sockaddr_in sin, from;
char c;
int lport = IPPORT_RESERVED - 1;
struct hostent *hp;
@ -84,6 +84,7 @@ rcmd(ahost, rport, locuser, remuser, cmd, fd2p)
return (-1);
}
fcntl(s, F_SETOWN, pid);
bzero((char *)&sin, sizeof sin);
sin.sin_family = hp->h_addrtype;
bcopy(hp->h_addr_list[0], (caddr_t)&sin.sin_addr, hp->h_length);
sin.sin_port = rport;

View File

@ -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.1 1993/10/07 07:29:41 cgd Exp $";
static char *rcsid = "$Id: clnt_generic.c,v 1.2 1993/12/05 14:36:48 deraadt Exp $";
#endif
/*
@ -73,9 +73,9 @@ clnt_create(hostname, prog, vers, proto)
rpc_createerr.cf_error.re_errno = EAFNOSUPPORT;
return (NULL);
}
bzero((char *)&sin, sizeof sin);
sin.sin_family = h->h_addrtype;
sin.sin_port = 0;
bzero(sin.sin_zero, sizeof(sin.sin_zero));
bcopy(h->h_addr, (char*)&sin.sin_addr, h->h_length);
p = getprotobyname(proto);
if (p == NULL) {

View File

@ -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.1 1993/10/07 07:29:44 cgd Exp $";
static char *rcsid = "$Id: clnt_simple.c,v 1.2 1993/12/05 14:36:58 deraadt Exp $";
#endif
/*
@ -91,6 +91,7 @@ callrpc(host, prognum, versnum, procnum, inproc, in, outproc, out)
return ((int) RPC_UNKNOWNHOST);
timeout.tv_usec = 0;
timeout.tv_sec = 5;
bzero((char *)&server_addr, sizeof server_addr);
bcopy(hp->h_addr, (char *)&server_addr.sin_addr, hp->h_length);
server_addr.sin_family = AF_INET;
server_addr.sin_port = 0;

View File

@ -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.1 1993/10/07 07:29:56 cgd Exp $";
static char *rcsid = "$Id: getrpcport.c,v 1.2 1993/12/05 14:37:02 deraadt Exp $";
#endif
/*
@ -50,6 +50,7 @@ getrpcport(host, prognum, versnum, proto)
if ((hp = gethostbyname(host)) == NULL)
return (0);
bzero((char *)&addr, sizeof addr);
bcopy(hp->h_addr, (char *) &addr.sin_addr, hp->h_length);
addr.sin_family = AF_INET;
addr.sin_port = 0;