Subject: lib/2424: svc routines missing initialization
To: None <gnats-bugs@NetBSD.ORG>
From: Arne Henrik Juul <arnej@imf.unit.no>
List: netbsd-bugs
Date: 05/16/1996 20:50:49
>Number:         2424
>Category:       lib
>Synopsis:       svc routines missing initialization
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    lib-bug-people (Library Bug People)
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Thu May 16 15:35:01 1996
>Last-Modified:
>Originator:     Arne H. Juul
>Organization:
	Norwegian University of Technology and Science
>Release:        NetBSD-current Thu May 16 20:41:48 MET DST 1996
>Environment:
	
System: NetBSD dvask.pvv.unit.no 1.1B NetBSD 1.1B (DVSK) #1: Sun May  5 20:41:15 MET DST 1996     arnej@dvask.pvv.unit.no:/usr/src/sys/arch/vax/compile/DVSK vax

>Description:
	When xprt_register is called the first time and allocates
	memory for the xports array, it doesn't zero it out.
	Later, when getreqset() processes the array it will test
	the pointer against NULL to see if it actually was in the set of
	pointers handled by the svc routines.  This breaks any program
	that adds its own file descriptors to the file descriptor set,
	like ypbind.  (It's probably because of lucky memory allocations
	or something that I've only observed this now on the VAX port).

>How-To-Repeat:
	run "ypbind" on NetBSD/vax, watch the core dump.
	Look at /usr/src/lib/libc/rpc/svc.c, around lines 394 and 89.
>Fix:
	
	Apply this fix in /usr/src/lib/libc/rpc.

--- svc.c	Sat Oct 14 01:51:00 1995
+++ /tmp/svc.c	Thu May 16 20:47:49 1996
@@ -46,6 +46,7 @@
  */
 
 #include <stdlib.h>
+#include <string.h>
 
 #include <sys/errno.h>
 #include <rpc/rpc.h>
@@ -87,6 +88,7 @@
 	if (xports == NULL) {
 		xports = (SVCXPRT **)
 			mem_alloc(FD_SETSIZE * sizeof(SVCXPRT *));
+		bzero(xports, FD_SETSIZE * sizeof(SVCXPRT *));
 	}
 	if (sock < FD_SETSIZE) {
 		xports[sock] = xprt;
>Audit-Trail:
>Unformatted: