Subject: Re: lib/2194: Missing bzero may cause coredumps of RPC programs.
To: None <gnats-bugs@NetBSD.ORG>
From: der Mouse <mouse@Daily-Planet.Rodents.Montreal.QC.CA>
List: netbsd-bugs
Date: 04/12/1996 20:22:56
> my28:/usr/src/usr.sbin/ypbind >diff -c /usr/src/lib/libc/rpc/svc.c svc.c
> --- //usr/src/lib/libc/rpc/svc.c        Sat Oct 14 01:51:00 1995
> ***************
> *** 87,93 ****
> 	if (xports == NULL) {
> 		xports = (SVCXPRT **)
>                         mem_alloc(FD_SETSIZE * sizeof(SVCXPRT *));
> +		bzero(xports, FD_SETSIZE * sizeof(SVCXPRT *));
> 	}
> 	if (sock < FD_SETSIZE) {
> 		xports[sock] = xprt;
> --- 87,92 ----

This assumes that nil-pointer is all-bits-zero.  Probably better would
be something more like

*** 87,93 ****
	if (xports == NULL) {
		int i;
		xports = (SVCXPRT **)
                        mem_alloc(FD_SETSIZE * sizeof(SVCXPRT *));
		for (i=0;i<FD_SETSIZE;i++) xports[i] = 0;
	}
	if (sock < FD_SETSIZE) {
		xports[sock] = xprt;
--- 87,92 ----

					der Mouse

			    mouse@collatz.mcrcim.mcgill.edu