diff --git a/sys/kern/vfs_cache.c b/sys/kern/vfs_cache.c index dedce0af56bc..8cc0bb4bee90 100644 --- a/sys/kern/vfs_cache.c +++ b/sys/kern/vfs_cache.c @@ -956,7 +956,8 @@ vn_fullpath1(struct thread *td, struct vnode *vp, struct vnode *rdir, if (vp->v_type != VDIR) { ncp = TAILQ_FIRST(&vp->v_cache_dst); if (ncp != NULL) { - for (i = ncp->nc_nlen - 1; i >= 0 && bp > buf; i--) + buflen -= ncp->nc_nlen; + for (i = ncp->nc_nlen - 1; i >= 0 && bp != buf; i--) *--bp = ncp->nc_name[i]; if (bp == buf) { numfullpathfail4++;