From owner-svn-src-stable@FreeBSD.ORG Wed Apr 25 04:53:05 2012 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 6AE48106566B; Wed, 25 Apr 2012 04:53:05 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 55CA88FC18; Wed, 25 Apr 2012 04:53:05 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q3P4r5wB080291; Wed, 25 Apr 2012 04:53:05 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q3P4r5RR080289; Wed, 25 Apr 2012 04:53:05 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201204250453.q3P4r5RR080289@svn.freebsd.org> From: Konstantin Belousov Date: Wed, 25 Apr 2012 04:53:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r234667 - stable/9/usr.bin/top X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 25 Apr 2012 04:53:05 -0000 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),