From owner-svn-src-all@FreeBSD.ORG Sun Dec 5 20:47:54 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 13170106566B; Sun, 5 Dec 2010 20:47:54 +0000 (UTC) (envelope-from dougb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 00F428FC12; Sun, 5 Dec 2010 20:47:54 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id oB5KlrPk007999; Sun, 5 Dec 2010 20:47:53 GMT (envelope-from dougb@svn.freebsd.org) Received: (from dougb@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id oB5KlrPB007997; Sun, 5 Dec 2010 20:47:53 GMT (envelope-from dougb@svn.freebsd.org) Message-Id: <201012052047.oB5KlrPB007997@svn.freebsd.org> From: Doug Barton Date: Sun, 5 Dec 2010 20:47:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r216202 - head/usr.bin/stat X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 05 Dec 2010 20:47:54 -0000 Author: dougb Date: Sun Dec 5 20:47:53 2010 New Revision: 216202 URL: http://svn.freebsd.org/changeset/base/216202 Log: Bring in the change from NetBSD 1.22: "Fix a trivial truncation case, and eliminate a corner case that might print a nul character." I am purposely bypassing the following versions: 1.19 A build infrastructure change that does not apply to us 1.20 A feature I am not interested in, but don't object if someone else wants to pick it up 1.21 A build infrastructure change that does not apply to us Obtained from: atatat@NetBSD.org Modified: head/usr.bin/stat/stat.c Modified: head/usr.bin/stat/stat.c ============================================================================== --- head/usr.bin/stat/stat.c Sun Dec 5 20:47:36 2010 (r216201) +++ head/usr.bin/stat/stat.c Sun Dec 5 20:47:53 2010 (r216202) @@ -30,7 +30,7 @@ #include #if 0 #ifndef lint -__RCSID("$NetBSD: stat.c,v 1.18 2004/05/28 04:48:31 atatat Exp $"); +__RCSID("$NetBSD: stat.c,v 1.22 2005/04/22 03:36:48 atatat Exp $"); #endif #endif @@ -381,7 +381,7 @@ output(const struct stat *st, const char const char *statfmt, int fn, int nonl, int quiet) { int flags, size, prec, ofmt, hilo, what; - char buf[PATH_MAX]; + char buf[PATH_MAX + 4 + 1]; const char *subfmt; int nl, t, i; @@ -550,7 +550,7 @@ output(const struct stat *st, const char buf, sizeof(buf), flags, size, prec, ofmt, hilo, what); - for (i = 0; i < t && i < sizeof(buf); i++) + for (i = 0; i < t && i < sizeof(buf) - 1; i++) addchar(stdout, buf[i], &nl); continue;