Avoid overflow of file buffer

Submitted by:	db
Approved by:	cperciva
MFC after:	2 weeks
This commit is contained in:
Eitan Adler 2012-12-05 13:56:46 +00:00
parent 61fd27bb3b
commit 6c3c59886c

View File

@ -394,7 +394,7 @@ pw_user(struct userconf * cnf, int mode, struct cargs * args)
/*
* 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);