Subject: Re: ypserv(8) stops working on 4.99.25 kernel
To: None <current-users@netbsd.org>
From: Geoff Wing <gcw@pobox.com>
List: current-users
Date: 08/17/2007 17:18:49
On Friday 2007-08-17 16:03 +1000, Michael van Elst output:
:On Thu, Aug 16, 2007 at 10:32:27PM +0100, David Laight wrote:
:Most interesting however is:
:# ypwhich -m
:ypwhich: clnt_call: localhost: netid.bynam: No such map in server's domain
:ypwhich: clnt_call: localhost: protocols.bynam: No such map in server's domain
:[...]
:Apparently ypwhich -m is broken.

The changeover to strlcpy() [~16 months ago] forgot to include the NUL byte
in the string length.

Regards,
Geoff

--- usr.sbin/ypserv/ypserv/ypserv_proc.c.org	2006-05-23 10:45:09.000000000 +1000
+++ usr.sbin/ypserv/ypserv/ypserv_proc.c	2007-08-17 17:13:09.000000000 +1000
@@ -490,7 +490,7 @@ ypproc_maplist_2_svc(void *argp, struct 
 
 			(void)memset(m, 0, sizeof(m));
 			(void)strlcpy(m->ypml_name, dp->d_name,
-			    (size_t)(dp->d_namlen - 3));
+			    (size_t)(dp->d_namlen - 2));
 			m->ypml_next = res.list;
 			res.list = m;
 		}