Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 25 Apr 2012 04:53:05 +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-9@freebsd.org
Subject:   svn commit: r234667 - stable/9/usr.bin/top
Message-ID:  <201204250453.q3P4r5RR080289@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
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),



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201204250453.q3P4r5RR080289>