From owner-svn-src-stable@freebsd.org Thu Oct 29 16:45:08 2015 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 16ECFA21F5A; Thu, 29 Oct 2015 16:45:08 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id D5D6B1D43; Thu, 29 Oct 2015 16:45:07 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t9TGj6YF063708; Thu, 29 Oct 2015 16:45:06 GMT (envelope-from delphij@FreeBSD.org) Received: (from delphij@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t9TGj6T3063707; Thu, 29 Oct 2015 16:45:06 GMT (envelope-from delphij@FreeBSD.org) Message-Id: <201510291645.t9TGj6T3063707@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: delphij set sender to delphij@FreeBSD.org using -f From: Xin LI Date: Thu, 29 Oct 2015 16:45:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r290146 - stable/10/usr.sbin/watch X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 29 Oct 2015 16:45:08 -0000 Author: delphij Date: Thu Oct 29 16:45:06 2015 New Revision: 290146 URL: https://svnweb.freebsd.org/changeset/base/290146 Log: MFC r288960: Use strlcpy() when the string is expected to be nul-terminated. Modified: stable/10/usr.sbin/watch/watch.c Directory Properties: stable/10/ (props changed) Modified: stable/10/usr.sbin/watch/watch.c ============================================================================== --- stable/10/usr.sbin/watch/watch.c Thu Oct 29 16:34:55 2015 (r290145) +++ stable/10/usr.sbin/watch/watch.c Thu Oct 29 16:45:06 2015 (r290146) @@ -247,7 +247,7 @@ set_dev(const char *name) if ((sb.st_mode & S_IFMT) != S_IFCHR) fatal(EX_DATAERR, "must be a character device"); - strncpy(dev_name, buf, DEV_NAME_LEN); + strlcpy(dev_name, buf, sizeof(dev_name)); attach_snp(); } @@ -340,7 +340,7 @@ main(int ac, char *av[]) else fatal(EX_DATAERR, "no device name given"); } else - strncpy(dev_name, *av, DEV_NAME_LEN); + strlcpy(dev_name, *av, sizeof(dev_name)); set_dev(dev_name);