Fix string buffer overflow when preparing the line of output.

PR:	bin/161739
Submitted by:	Jeremy Chadwick <freebsd jdc parodius com>
MFC after:	1 week
This commit is contained in:
Konstantin Belousov 2012-04-18 10:23:42 +00:00
parent 63297dfd4a
commit bf313207fc
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=234416

View File

@ -933,7 +933,7 @@ format_next_process(caddr_t handle, char *(*get_userid)(int), int flags)
p_tot = rup->ru_inblock + rup->ru_oublock + rup->ru_majflt;
s_tot = total_inblock + total_oublock + total_majflt;
sprintf(fmt, io_Proc_format,
snprintf(fmt, sizeof(fmt), io_Proc_format,
pp->ki_pid,
jid_buf,
namelength, namelength, (*get_userid)(pp->ki_ruid),
@ -961,7 +961,7 @@ format_next_process(caddr_t handle, char *(*get_userid)(int), int flags)
snprintf(thr_buf, sizeof(thr_buf), "%*d ",
sizeof(thr_buf) - 2, pp->ki_numthreads);
sprintf(fmt, proc_fmt,
snprintf(fmt, sizeof(fmt), proc_fmt,
pp->ki_pid,
jid_buf,
namelength, namelength, (*get_userid)(pp->ki_ruid),