1
0
mirror of https://git.FreeBSD.org/src.git synced 2024-12-15 10:17:20 +00:00

Fully initialize (bzero) the stack-allocated "struct sockaddr_in server"

structure. Random junk on the stack would cause the call to bind to fail
in some cases (since the address portion wasn't initialized).
This commit is contained in:
David Greenman 1995-05-15 09:56:49 +00:00
parent f8a6f4a227
commit 84fbd1c727
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=8532

View File

@ -42,7 +42,7 @@ static char sccsid[] = "@(#)timed.c 8.1 (Berkeley) 6/6/93";
#endif /* not lint */
#ifdef sgi
#ident "$Revision: 1.25 $"
#ident "$Revision: 1.1.1.1 $"
#endif /* sgi */
#define TSPTYPES
@ -312,6 +312,7 @@ main(argc, argv)
exit(1);
}
port = srvp->s_port;
bzero(&server, sizeof(struct sockaddr_in));
server.sin_port = srvp->s_port;
server.sin_family = AF_INET;
sock = socket(AF_INET, SOCK_DGRAM, 0);