grep in /usr/src/sys for SYSCTL_OUT.*strlen and you find 31 occurrances, 11 of which have a +1 and 20 of which don't. It appears that adding one to account for the nullterm is correct, but I don't have time right now to followup and fix them all, so I'm opening this PR so it doesn't get forgotten.
A commit references this bug: Author: ian Date: Thu Mar 12 18:06:31 UTC 2015 New revision: 279932 URL: https://svnweb.freebsd.org/changeset/base/279932 Log: Nullterminate strings returned via sysctl. PR: 195668 Changes: head/sys/vm/vm_phys.c head/sys/vm/vm_reserv.c
A commit references this bug: Author: ian Date: Thu Mar 12 18:09:40 UTC 2015 New revision: 279933 URL: https://svnweb.freebsd.org/changeset/base/279933 Log: Nullterminate strings returned via sysctl. PR: 195668 Changes: head/sys/dev/wbwd/wbwd.c
A commit references this bug: Author: ian Date: Thu Mar 12 18:22:21 UTC 2015 New revision: 279934 URL: https://svnweb.freebsd.org/changeset/base/279934 Log: Nullterminate strings returned via sysctl. PR: 195668 Changes: head/sys/dev/cxgbe/t4_l2t.c head/sys/dev/cxgbe/t4_main.c
A commit references this bug: Author: ian Date: Sat Mar 14 13:00:38 UTC 2015 New revision: 279982 URL: https://svnweb.freebsd.org/changeset/base/279982 Log: Revert r279932; this is going to be fixed in the sbuf code instead. PR: 195668 Changes: head/sys/vm/vm_phys.c head/sys/vm/vm_reserv.c
A commit references this bug: Author: ian Date: Sat Mar 14 13:02:09 UTC 2015 New revision: 279983 URL: https://svnweb.freebsd.org/changeset/base/279983 Log: Revert r279933; this is going to be fixed in sbuf instead. PR: 195668 Changes: head/sys/dev/wbwd/wbwd.c
A commit references this bug: Author: ian Date: Sat Mar 14 13:04:40 UTC 2015 New revision: 279984 URL: https://svnweb.freebsd.org/changeset/base/279984 Log: Revert r279934, r279938; this is going to be fixed in sbuf instead. PR: 195668 Changes: head/sys/dev/cxgbe/t4_l2t.c head/sys/dev/cxgbe/t4_main.c
A commit references this bug: Author: ian Date: Sat Mar 14 17:08:30 UTC 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.) Remove explicit adding of a nulterm byte in a couple places now that it gets done automatically by the sbuf drain code. PR: 195668 Changes: head/sys/dev/cxgb/cxgb_sge.c head/sys/dev/cxgbe/t4_main.c head/sys/kern/kern_descrip.c head/sys/kern/kern_malloc.c head/sys/kern/kern_proc.c head/sys/kern/kern_sysctl.c head/sys/vm/uma_core.c
A commit references this bug: Author: ian Date: Sat Mar 14 18:11:25 UTC 2015 New revision: 279997 URL: https://svnweb.freebsd.org/changeset/base/279997 Log: Use sbuf_new_for_sysctl() instead of plain sbuf_new() to ensure sysctl string returned to userland is nulterminated. PR: 195668 Changes: head/sys/netinet/tcp_hostcache.c
A commit references this bug: Author: ian Date: Sat Mar 14 18:42:31 UTC 2015 New revision: 279999 URL: https://svnweb.freebsd.org/changeset/base/279999 Log: Use sbuf_new_for_sysctl() instead of plain sbuf_new() to ensure sysctl string returned to userland is nulterminated. PR: 195668 Changes: head/sys/kern/sched_ule.c
A commit references this bug: Author: ian Date: Sat Mar 14 18:46:33 UTC 2015 New revision: 280000 URL: https://svnweb.freebsd.org/changeset/base/280000 Log: Use sbuf_new_for_sysctl() instead of plain sbuf_new() to ensure sysctl string returned to userland is nulterminated. PR: 195668 Changes: head/sys/kern/kern_fail.c
A commit references this bug: Author: ian Date: Sat Mar 14 21:40:02 UTC 2015 New revision: 280006 URL: https://svnweb.freebsd.org/changeset/base/280006 Log: Use SYSCTL_OUT_STR() to return strings. PR: 195668 Changes: head/sys/kern/subr_bus.c head/sys/kern/subr_param.c
A commit references this bug: Author: ian Date: Sat Mar 14 21:40:25 UTC 2015 New revision: 280007 URL: https://svnweb.freebsd.org/changeset/base/280007 Log: Use SYSCTL_OUT_STR() to return strings. PR: 195668 Changes: head/sys/xen/xenbus/xenbusb.c
A commit references this bug: Author: ian Date: Sat Mar 14 21:40:33 UTC 2015 New revision: 280008 URL: https://svnweb.freebsd.org/changeset/base/280008 Log: Use SYSCTL_OUT_STR() to return strings. PR: 195668 Changes: head/sys/dev/usb/net/usb_ethernet.c
A commit references this bug: Author: ian Date: Sat Mar 14 21:40:52 UTC 2015 New revision: 280009 URL: https://svnweb.freebsd.org/changeset/base/280009 Log: Use SYSCTL_OUT_STR() to return strings. PR: 195668 Changes: head/sys/mips/rmi/dev/iic/at24co2n.c
A commit references this bug: Author: ian Date: Sat Mar 14 21:41:01 UTC 2015 New revision: 280010 URL: https://svnweb.freebsd.org/changeset/base/280010 Log: Use SYSCTL_OUT_STR() to return strings. PR: 195668 Changes: head/sys/net80211/ieee80211_freebsd.c
A commit references this bug: Author: ian Date: Sat Mar 14 22:32:16 UTC 2015 New revision: 280011 URL: https://svnweb.freebsd.org/changeset/base/280011 Log: Use sysctl_handle_string() and the sbuf printf routines instead of large stack-allocated buffers and snprintf(). PR: 195668 Changes: head/sys/dev/iscsi_initiator/isc_sm.c
A commit references this bug: Author: ian Date: Sun Mar 15 00:36:09 UTC 2015 New revision: 280015 URL: https://svnweb.freebsd.org/changeset/base/280015 Log: Include the nulterm byte in the sysctl string. PR: 195668 Changes: head/sys/kern/kern_cons.c
A commit references this bug: Author: ian Date: Sun Mar 15 00:39:19 UTC 2015 New revision: 280016 URL: https://svnweb.freebsd.org/changeset/base/280016 Log: Add a nulterm byte to the returned sysctl string. PR: 195668 Changes: head/sys/kern/subr_prf.c
To originators/assignees of this PR: A commit to the tree references this PR, however the PR is still in a non-closed state. Please review this PR and close as appropriate, or if closing the PR requires a merge to stable/10, please let re@ know as soon as possible. Thank you. Glen
Long overdue closing of this bug. Several more commits were done that neglected to cite the PR number. As far as I know the last commit related to this was r280355 on 2015/03/22.