Use sbuf_new_for_sysctl() instead of plain sbuf_new() to ensure sysctl

string returned to userland is nulterminated.

PR:           195668
This commit is contained in:
Ian Lepore 2015-03-14 18:46:33 +00:00
parent b97fa22cd6
commit b773372938
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=280000

View File

@ -394,11 +394,10 @@ fail_point_sysctl(SYSCTL_HANDLER_ARGS)
int error;
/* Retrieving */
sbuf_new(&sb, NULL, 128, SBUF_AUTOEXTEND);
sbuf_new_for_sysctl(&sb, NULL, 128, req);
fail_point_get(fp, &sb);
sbuf_trim(&sb);
sbuf_finish(&sb);
error = SYSCTL_OUT(req, sbuf_data(&sb), sbuf_len(&sb));
error = sbuf_finish(&sb);
sbuf_delete(&sb);
/* Setting */