Date: Wed, 25 Apr 2012 04:57:29 +0000 (UTC) From: Konstantin Belousov <kib@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r234668 - stable/8/usr.bin/top Message-ID: <201204250457.q3P4vUEF080487@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: kib Date: Wed Apr 25 04:57:29 2012 New Revision: 234668 URL: http://svn.freebsd.org/changeset/base/234668 Log: MFC r234416: Fix string buffer overflow when preparing the line of output. PR: bin/161739 Modified: stable/8/usr.bin/top/machine.c Directory Properties: stable/8/usr.bin/top/ (props changed) Modified: stable/8/usr.bin/top/machine.c ============================================================================== --- stable/8/usr.bin/top/machine.c Wed Apr 25 04:53:04 2012 (r234667) +++ stable/8/usr.bin/top/machine.c Wed Apr 25 04:57:29 2012 (r234668) @@ -932,7 +932,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), @@ -960,7 +960,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),
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201204250457.q3P4vUEF080487>