From owner-svn-src-head@freebsd.org Tue Oct 6 22:49:27 2015 Return-Path: Delivered-To: svn-src-head@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 23E7C9D0E08; Tue, 6 Oct 2015 22:49:27 +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 E47DA116E; Tue, 6 Oct 2015 22:49:26 +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 t96MnQAe066534; Tue, 6 Oct 2015 22:49:26 GMT (envelope-from delphij@FreeBSD.org) Received: (from delphij@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t96MnQil066533; Tue, 6 Oct 2015 22:49:26 GMT (envelope-from delphij@FreeBSD.org) Message-Id: <201510062249.t96MnQil066533@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: delphij set sender to delphij@FreeBSD.org using -f From: Xin LI Date: Tue, 6 Oct 2015 22:49:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r288960 - head/usr.sbin/watch X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.20 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: Tue, 06 Oct 2015 22:49:27 -0000 Author: delphij Date: Tue Oct 6 22:49:25 2015 New Revision: 288960 URL: https://svnweb.freebsd.org/changeset/base/288960 Log: Use strlcpy() when the string is expected to be nul-terminated. MFC after: 2 weeks Modified: head/usr.sbin/watch/watch.c Modified: head/usr.sbin/watch/watch.c ============================================================================== --- head/usr.sbin/watch/watch.c Tue Oct 6 22:45:23 2015 (r288959) +++ head/usr.sbin/watch/watch.c Tue Oct 6 22:49:25 2015 (r288960) @@ -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);