svn commit: r234667 - stable/9/usr.bin/top
Konstantin Belousov
kib at FreeBSD.org
Wed Apr 25 04:53:05 UTC 2012
Author: kib
Date: Wed Apr 25 04:53:04 2012
New Revision: 234667
URL: http://svn.freebsd.org/changeset/base/234667
Log:
MFC r234416:
Fix string buffer overflow when preparing the line of output.
PR: bin/161739
Modified:
stable/9/usr.bin/top/machine.c
Directory Properties:
stable/9/usr.bin/top/ (props changed)
Modified: stable/9/usr.bin/top/machine.c
==============================================================================
--- stable/9/usr.bin/top/machine.c Wed Apr 25 02:46:13 2012 (r234666)
+++ stable/9/usr.bin/top/machine.c Wed Apr 25 04:53:04 2012 (r234667)
@@ -933,7 +933,7 @@ format_next_process(caddr_t handle, char
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
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),
More information about the svn-src-stable-9
mailing list