Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 23 May 2016 05:21:55 +0000 (UTC)
From:      Don Lewis <truckman@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org
Subject:   svn commit: r300459 - stable/10/usr.sbin/makefs
Message-ID:  <201605230521.u4N5LtQZ085468@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: truckman
Date: Mon May 23 05:21:55 2016
New Revision: 300459
URL: https://svnweb.freebsd.org/changeset/base/300459

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

Modified:
  stable/10/usr.sbin/makefs/mtree.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/usr.sbin/makefs/mtree.c
==============================================================================
--- stable/10/usr.sbin/makefs/mtree.c	Mon May 23 05:19:37 2016	(r300458)
+++ stable/10/usr.sbin/makefs/mtree.c	Mon May 23 05:21:55 2016	(r300459)
@@ -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;



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