From owner-svn-src-head@FreeBSD.ORG Sat Dec 18 00:30:52 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 9CB79106566B; Sat, 18 Dec 2010 00:30:52 +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 8B0DC8FC0C; Sat, 18 Dec 2010 00:30:52 +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 oBI0UqkB027584; Sat, 18 Dec 2010 00:30:52 GMT (envelope-from dougb@svn.freebsd.org) Received: (from dougb@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id oBI0UqYS027582; Sat, 18 Dec 2010 00:30:52 GMT (envelope-from dougb@svn.freebsd.org) Message-Id: <201012180030.oBI0UqYS027582@svn.freebsd.org> From: Doug Barton Date: Sat, 18 Dec 2010 00:30:52 +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: r216512 - head/usr.bin/stat X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 18 Dec 2010 00:30:52 -0000 Author: dougb Date: Sat Dec 18 00:30:52 2010 New Revision: 216512 URL: http://svn.freebsd.org/changeset/base/216512 Log: Bring in the relevant changes from NetBSD's 1.31: "Use strlcpy, not strncpy, when the desired semantics are strlcpy's rather than strncpy's." Note: NetBSD's 1.32 is their adoption of our r216206 Obtained from: dholland@NetBSD.org Modified: head/usr.bin/stat/stat.c Modified: head/usr.bin/stat/stat.c ============================================================================== --- head/usr.bin/stat/stat.c Fri Dec 17 22:41:22 2010 (r216511) +++ head/usr.bin/stat/stat.c Sat Dec 18 00:30:52 2010 (r216512) @@ -30,7 +30,7 @@ #include #if 0 #ifndef lint -__RCSID("$NetBSD: stat.c,v 1.30 2010/11/25 04:33:30 dholland Exp $" +__RCSID("$NetBSD: stat.c,v 1.31 2010/12/16 05:30:16 dholland Exp $" "$OpenBSD: stat.c,v 1.14 2009/06/24 09:44:25 sobrado Exp $"); #endif #endif @@ -789,7 +789,7 @@ format1(const struct stat *st, small = 0; data = 0; if (file == NULL) { - (void)strncpy(path, "(stdin)", sizeof(path)); + (void)strlcpy(path, "(stdin)", sizeof(path)); sdata = path; } else { snprintf(path, sizeof(path), " -> "); @@ -877,7 +877,7 @@ format1(const struct stat *st, case SHOW_filename: small = 0; data = 0; - (void)strncpy(path, file, sizeof(path)); + (void)strlcpy(path, file, sizeof(path)); sdata = path; formats = FMTF_STRING; if (ofmt == 0)