fsck(8): Don't overrun mount device buffer

Apply a very similar fix to r299460 (fsck_ffs) to apparently duplicated code
in fsck.

Reported by:	Coverity
CID:		1006789
Sponsored by:	Dell EMC Isilon
This commit is contained in:
Conrad Meyer 2017-04-14 00:22:28 +00:00
parent 63298eb19c
commit bcbaf9fd47
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=316801

View File

@ -172,6 +172,9 @@ getmntpt(const char *name)
statfsp = &mntbuf[i];
dev_name = statfsp->f_mntfromname;
if (*dev_name != '/') {
if (strlen(_PATH_DEV) + strlen(dev_name) + 1 >
sizeof(statfsp->f_mntfromname))
continue;
strcpy(device, _PATH_DEV);
strcat(device, dev_name);
strcpy(statfsp->f_mntfromname, device);