summaryrefslogtreecommitdiffstats
path: root/sys/vm
diff options
context:
space:
mode:
authorian <ian@FreeBSD.org>2015-03-14 17:08:28 +0000
committerian <ian@FreeBSD.org>2015-03-14 17:08:28 +0000
commit0dd684d23f5fa183acbeba8ba19a2dcd92d01c7d (patch)
tree15f05881ac7348ea6410bf891ab1547fb695271e /sys/vm
parentf3eb74c4901aa5758ec50eae05eb00c9aef92716 (diff)
downloadFreeBSD-src-0dd684d23f5fa183acbeba8ba19a2dcd92d01c7d.zip
FreeBSD-src-0dd684d23f5fa183acbeba8ba19a2dcd92d01c7d.tar.gz
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
Diffstat (limited to 'sys/vm')
-rw-r--r--sys/vm/uma_core.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/sys/vm/uma_core.c b/sys/vm/uma_core.c
index 5e8eb60..2bb6260 100644
--- a/sys/vm/uma_core.c
+++ b/sys/vm/uma_core.c
@@ -3451,6 +3451,7 @@ sysctl_vm_zone_stats(SYSCTL_HANDLER_ARGS)
if (error != 0)
return (error);
sbuf_new_for_sysctl(&sbuf, NULL, 128, req);
+ sbuf_clear_flags(&sbuf, SBUF_INCLUDENUL);
count = 0;
rw_rlock(&uma_rwlock);
OpenPOWER on IntegriCloud