]> git.cameronkatri.com Git - pw-darwin.git/commitdiff
Avoid overflow of file buffer
authorEitan Adler <eadler@FreeBSD.org>
Wed, 5 Dec 2012 13:56:46 +0000 (13:56 +0000)
committerEitan Adler <eadler@FreeBSD.org>
Wed, 5 Dec 2012 13:56:46 +0000 (13:56 +0000)
Submitted by: db
Approved by: cperciva
MFC after: 2 weeks

pw/pw_user.c

index abf1c354bc03de9a071caed86303851f9c100d62..23a78563e1a23e8b8dc0eb72b45bca52eeb7a62d 100644 (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);