On Wed, Dec 05, 2012 at 01:56:46PM +0000, Eitan Adler wrote:
> 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

Buffer won't overflow, but the path will be truncated, which is neither
detected nor handled.

>   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);

-- 
Pawel Jakub Dawidek                       http://www.wheelsystems.com
FreeBSD committer                         http://www.FreeBSD.org
Am I Evil? Yes, I Am!                     http://tupytaj.pl

Attachment: pgprWhMDujjXT.pgp
Description: PGP signature

Reply via email to