svn commit: r279993 - in head/sys: dev/cxgb dev/cxgbe kern vm
Ian Lepore
ian at freebsd.org
Sun Mar 22 21:20:31 UTC 2015
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 at 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
More information about the svn-src-all
mailing list