Subject: Re: cleaning up the rest of dtom()
To: enami tsugutomo <enami@cv.sony.co.jp>
From: Jason Thorpe <thorpej@nas.nasa.gov>
List: tech-kern
Date: 06/24/1997 11:58:28
On 24 Jun 1997 15:47:39 +0900 
 enami tsugutomo <enami@cv.sony.co.jp> wrote:

 > > + 	if (nam->m_len > sizeof(struct sockaddr_un))
 > > + 		return (EINVAL);
 > >   	if (unp->unp_vnode != 0)
 > >   		return (EINVAL);
 > >   	NDINIT(&nd, CREATE, FOLLOW | LOCKPARENT, UIO_SYSSPACE,
 > 
 > If we check length of socket name strictly, the XXX marked test just
 > after this NDINIT line (which tests special case that sun_path is 105
 > byte + nul in case of NetBSD/i386) can be eliminated, can't it?  Or,
 > supposed to be done in next step?

Well, the first check would definitely ensure that the path name was
103 bytes + nul... (sun_path is declared as "char sun_path[104]").

Why would it ever be 105+nul in the first place?

Jason R. Thorpe                                       thorpej@nas.nasa.gov
NASA Ames Research Center                               Home: 408.866.1912
NAS: M/S 258-6                                          Work: 415.604.0935
Moffett Field, CA 94035                                Pager: 415.428.6939