Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 14 Apr 2017 00:22:28 +0000 (UTC)
From:      Conrad Meyer <cem@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r316801 - head/sbin/fsck
Message-ID:  <201704140022.v3E0MSZC019702@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: cem
Date: Fri Apr 14 00:22:28 2017
New Revision: 316801
URL: https://svnweb.freebsd.org/changeset/base/316801

Log:
  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

Modified:
  head/sbin/fsck/fsutil.c

Modified: head/sbin/fsck/fsutil.c
==============================================================================
--- head/sbin/fsck/fsutil.c	Fri Apr 14 00:15:34 2017	(r316800)
+++ head/sbin/fsck/fsutil.c	Fri Apr 14 00:22:28 2017	(r316801)
@@ -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);



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201704140022.v3E0MSZC019702>