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:
parent
30395bb5f1
commit
dee921f457
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user