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);
_______________________________________________
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Reply via email to