Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 5 Dec 2012 13:56:46 +0000 (UTC)
From:      Eitan Adler <eadler@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r243895 - head/usr.sbin/pw
Message-ID:  <201212051356.qB5Duks1068301@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: eadler
Date: Wed Dec  5 13:56:46 2012
New Revision: 243895
URL: http://svnweb.freebsd.org/changeset/base/243895

Log:
  Avoid overflow of file buffer
  
  Submitted by:	db
  Approved by:	cperciva
  MFC after:	2 weeks

Modified:
  head/usr.sbin/pw/pw_user.c

Modified: head/usr.sbin/pw/pw_user.c
==============================================================================
--- head/usr.sbin/pw/pw_user.c	Wed Dec  5 13:56:43 2012	(r243894)
+++ head/usr.sbin/pw/pw_user.c	Wed Dec  5 13:56:46 2012	(r243895)
@@ -394,7 +394,7 @@ pw_user(struct userconf * cnf, int mode,
 				/*
 				 * Remove crontabs
 				 */
-				sprintf(file, "/var/cron/tabs/%s", pwd->pw_name);
+				snprintf(file, sizeof(file), "/var/cron/tabs/%s", pwd->pw_name);
 				if (access(file, F_OK) == 0) {
 					sprintf(file, "crontab -u %s -r", pwd->pw_name);
 					system(file);



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