Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 22 Mar 2015 15:20:25 -0600
From:      Ian Lepore <ian@freebsd.org>
To:        Tijl Coosemans <tijl@FreeBSD.org>
Cc:        svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org
Subject:   Re: svn commit: r279993 - in head/sys: dev/cxgb dev/cxgbe kern vm
Message-ID:  <1427059225.49126.5.camel@freebsd.org>
In-Reply-To: <20150322171110.2af31564@kalimero.tijl.coosemans.org>
References:  <201503141708.t2EH8TdR074383@svn.freebsd.org> <20150322171110.2af31564@kalimero.tijl.coosemans.org>

next in thread | previous in thread | raw e-mail | index | archive | help
On Sun, 2015-03-22 at 17:11 +0100, Tijl Coosemans wrote:
> On Sat, 14 Mar 2015 17:08:29 +0000 (UTC) Ian Lepore <ian@FreeBSD.org> wrote:
> > Author: ian
> > Date: Sat Mar 14 17:08:28 2015
> > New Revision: 279993
> > URL: https://svnweb.freebsd.org/changeset/base/279993
> > 
> > Log:
> >   Set the SBUF_INCLUDENUL flag in sbuf_new_for_sysctl() so that sysctl
> >   strings returned to userland include the nulterm byte.
> >   
> >   Some uses of sbuf_new_for_sysctl() write binary data rather than strings;
> >   clear the SBUF_INCLUDENUL flag after calling sbuf_new_for_sysctl() in
> >   those cases.  (Note that the sbuf code still automatically adds a nulterm
> >   byte in sbuf_finish(), but since it's not included in the length it won't
> >   get copied to userland along with the binary data.)
> 
> Can you review the attached patch?  The KERN_PROC_ENV sysctl is also
> binary (zero-terminated strings).  Adding an extra \0 at the end makes
> some programs think there's an extra empty environment variable.  It
> causes console-kit-daemon to crash for instance.
> 
> I suspect a similar patch may be needed for KERN_PROC_ARGS.

I think you're right.  The OID format isn't "A" so it shouldn't be
formatted as a normal C string, for both argv and envv.  I commited the
fix as r280355, thanks.

-- Ian




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