svn commit: r299953 - head/usr.sbin/makefs

Don Lewis truckman at FreeBSD.org
Mon May 16 16:16:47 UTC 2016


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;


More information about the svn-src-head mailing list