Fixes a potential buffer overflow with the pid filename.

Submitted by:	Mike Heffner <spock@techfour.net>
Submitted on:	audit@freebsd.org
This commit is contained in:
Josef Karthauser 2000-04-30 21:04:36 +00:00
parent 30395bb5f1
commit dee921f457

View File

@ -214,7 +214,9 @@ main(argc, argv)
dvname = devicename;
else
dvname++;
sprintf(pidfile, PIDFILE, _PATH_VARRUN, dvname);
if (snprintf(pidfile, sizeof(pidfile), PIDFILE, _PATH_VARRUN, dvname) >= sizeof(pidfile))
usage();
if ((pfd = fopen(pidfile, "r")) != NULL) {
if (fscanf(pfd, "%ld\n", &lpid) == 1) {
pid = lpid;