Nullterminate strings returned via sysctl.

PR:		195668
This commit is contained in:
Ian Lepore 2015-03-12 18:22:20 +00:00
parent 0b9b8739c0
commit 9bc58e3d33
2 changed files with 2 additions and 0 deletions

View File

@ -321,6 +321,7 @@ sysctl_l2t(SYSCTL_HANDLER_ARGS)
mtx_unlock(&e->lock);
}
sbuf_putc(&sb, 0); /* nullterm */
rc = sbuf_finish(sb);
sbuf_delete(sb);

View File

@ -5090,6 +5090,7 @@ sysctl_int_array(SYSCTL_HANDLER_ARGS)
for (i = arg1; arg2; arg2 -= sizeof(int), i++)
sbuf_printf(&sb, "%d ", *i);
sbuf_trim(&sb);
sbuf_putc(&sb, 0); /* nullterm */
sbuf_finish(&sb);
rc = sysctl_handle_string(oidp, sbuf_data(&sb), sbuf_len(&sb), req);
sbuf_delete(&sb);