Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 7 Jul 2008 16:29:15 -0400
From:      Ed Maste <emaste@freebsd.org>
To:        Alfred Perlstein <alfred@freebsd.org>
Cc:        cvs-src@FreeBSD.org, src-committers@FreeBSD.org, Ed Maste <emaste@FreeBSD.org>, cvs-all@FreeBSD.org
Subject:   Re: cvs commit: src/sys/kern uipc_usrreq.c
Message-ID:  <20080707202915.GA17691@sandvine.com>
In-Reply-To: <20080707195209.GD95574@elvis.mu.org>
References:  <200807032326.m63NQCdW044654@repoman.freebsd.org> <20080707195209.GD95574@elvis.mu.org>

next in thread | previous in thread | raw e-mail | index | archive | help
On Mon, Jul 07, 2008 at 12:52:09PM -0700, Alfred Perlstein wrote:

> * Ed Maste <emaste@FreeBSD.org> [080703 16:26] wrote:
> > emaste      2008-07-03 23:26:10 UTC
> > 
> >   FreeBSD src repository
> > 
> >   Modified files:
> >     sys/kern             uipc_usrreq.c 
> >   Log:
> >   SVN rev 180238 on 2008-07-03 23:26:10Z by emaste
> >   
> >   Use bcopy instead of strlcpy in uipc_bind and unp_connect, since
> >   soun->sun_path isn't a null-terminated string.  As UNIX(4) states, "the
> >   terminating NUL is not part of the address."  Since strlcpy has to return
> >   "the total length of the string [it] tried to create," it walks off the end
> >   of soun->sun_path looking for a \0.
> >   
> >   This reverts r105332.
> >   
> >   Reported by:    Ryan Stone
> >   
> >   Revision  Changes    Path
> >   1.215     +4 -2      src/sys/kern/uipc_usrreq.c
>
> This really deserves a comment at each invocation of bcopy in
> order to prevent regressions by someone "fixing" it again.

I thought about that but figured that a bcopy -> strlcpy conversion
would be a lot less likely than the strncpy -> strlcpy change that
happened here originally to introduce the bug.  If it really seems like
a candidate for someone to "fix" in the future I'll add a comment. 

- Ed



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20080707202915.GA17691>