Zero struct sockaddr_??s before filling them in.
Suggested by: Theo de Raadt <deraadt@cvs.openbsd.org>
This commit is contained in:
parent
aa2e5be7ae
commit
2e14bb4605
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=31914
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* $Id: server.c,v 1.11 1997/11/22 03:37:45 brian Exp $
|
||||
* $Id: server.c,v 1.12 1997/12/03 10:23:53 brian Exp $
|
||||
*/
|
||||
|
||||
#include <sys/param.h>
|
||||
@ -46,6 +46,7 @@ ServerLocalOpen(const char *name, mode_t mask)
|
||||
return 1;
|
||||
}
|
||||
|
||||
memset(&ifsun, '\0', sizeof ifsun);
|
||||
ifsun.sun_len = strlen(name);
|
||||
if (ifsun.sun_len > sizeof ifsun.sun_path - 1) {
|
||||
LogPrintf(LogERROR, "Local: %s: Path too long\n", name);
|
||||
@ -108,6 +109,7 @@ ServerTcpOpen(int port)
|
||||
LogPrintf(LogERROR, "Tcp: socket: %s\n", strerror(errno));
|
||||
return 7;
|
||||
}
|
||||
memset(&ifsin, '\0', sizeof ifsin);
|
||||
ifsin.sin_family = AF_INET;
|
||||
ifsin.sin_addr.s_addr = INADDR_ANY;
|
||||
ifsin.sin_port = htons(port);
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* $Id: pppctl.c,v 1.11 1997/12/17 00:26:58 brian Exp $
|
||||
* $Id: pppctl.c,v 1.12 1997/12/18 00:29:56 brian Exp $
|
||||
*/
|
||||
|
||||
#include <sys/types.h>
|
||||
@ -210,6 +210,7 @@ main(int argc, char **argv)
|
||||
sock = (struct sockaddr *)&ifsun;
|
||||
socksz = sizeof ifsun;
|
||||
|
||||
memset(&ifsun, '\0', sizeof ifsun);
|
||||
ifsun.sun_len = strlen(argv[arg]);
|
||||
if (ifsun.sun_len > sizeof ifsun.sun_path - 1) {
|
||||
fprintf(stderr, "%s: Path too long\n", argv[arg]);
|
||||
@ -239,6 +240,7 @@ main(int argc, char **argv)
|
||||
socksz = sizeof ifsin;
|
||||
hlen = strlen(host);
|
||||
|
||||
memset(&ifsin, '\0', sizeof ifsin);
|
||||
if (strspn(host, "0123456789.") == hlen) {
|
||||
if (!inet_aton(host, &ifsin.sin_addr)) {
|
||||
fprintf(stderr, "Cannot translate %s\n", host);
|
||||
|
Loading…
Reference in New Issue
Block a user