Subject: Re: lib/2424: svc routines missing initialization
To: None <arnej@imf.unit.no>
From: der Mouse <mouse@Collatz.McRCIM.McGill.EDU>
List: netbsd-bugs
Date: 05/16/1996 21:20:08
>  	if (xports == NULL) {
>  		xports = (SVCXPRT **)
>  			mem_alloc(FD_SETSIZE * sizeof(SVCXPRT *));
> +		bzero(xports, FD_SETSIZE * sizeof(SVCXPRT *));
>  	}

Except that that sets the allocated memory to all-zero-bits, when
what's needed is to fill it with nil pointers.  (Yeah, on most present
machines there's no difference, it's just a bug waiting to happen.  And
since it's really easy to do it right....)

Here's the fix I've got in my patch tree for that file:

--- OLD/lib/libc/rpc/svc.c	Thu Jan  1 00:00:00 1970
+++ NEW/lib/libc/rpc/svc.c	Thu Jan  1 00:00:00 1970
@@ -85,8 +85,10 @@
 	register int sock = xprt->xp_sock;
 
 	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;

					der Mouse

			    mouse@collatz.mcrcim.mcgill.edu