Author: truckman
Date: Mon May 16 16:16:46 2016
New Revision: 299953
URL: https://svnweb.freebsd.org/changeset/base/299953

Log:
  Fix an off by one error to avoid overflowing rp[].
  
  Reported by:  Coverity
  CID:          1007579

Modified:
  head/usr.sbin/makefs/mtree.c

Modified: head/usr.sbin/makefs/mtree.c
==============================================================================
--- head/usr.sbin/makefs/mtree.c        Mon May 16 16:01:46 2016        
(r299952)
+++ head/usr.sbin/makefs/mtree.c        Mon May 16 16:16:46 2016        
(r299953)
@@ -150,7 +150,7 @@ mtree_file_path(fsnode *node)
 
        depth = 0;
        rp[depth] = node->name;
-       for (pnode = node->parent; pnode && depth < MAKEFS_MAX_TREE_DEPTH;
+       for (pnode = node->parent; pnode && depth < MAKEFS_MAX_TREE_DEPTH - 1;
             pnode = pnode->parent) {
                if (strcmp(pnode->name, ".") == 0)
                        break;
_______________________________________________
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