mirror of
https://github.com/freebsd/freebsd-src
synced 2024-09-06 17:18:32 +00:00
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
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=59799
|
@ -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 a new issue