Subject: lib/2424: svc routines missing initialization
To: None <gnats-bugs@NetBSD.ORG>
From: Arne Henrik Juul <>
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
>Originator:     Arne H. Juul
	Norwegian University of Technology and Science
>Release:        NetBSD-current Thu May 16 20:41:48 MET DST 1996
System: NetBSD 1.1B NetBSD 1.1B (DVSK) #1: Sun May  5 20:41:15 MET DST 1996 vax

	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).

	run "ypbind" on NetBSD/vax, watch the core dump.
	Look at /usr/src/lib/libc/rpc/svc.c, around lines 394 and 89.
	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;