From owner-svn-src-head@FreeBSD.ORG Fri Oct 17 21:14:51 2008 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 238291065688; Fri, 17 Oct 2008 21:14:51 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 11D518FC12; Fri, 17 Oct 2008 21:14:51 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id m9HLEodk098058; Fri, 17 Oct 2008 21:14:50 GMT (envelope-from delphij@svn.freebsd.org) Received: (from delphij@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id m9HLEoE2098056; Fri, 17 Oct 2008 21:14:50 GMT (envelope-from delphij@svn.freebsd.org) Message-Id: <200810172114.m9HLEoE2098056@svn.freebsd.org> From: Xin LI Date: Fri, 17 Oct 2008 21:14:50 +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: r183988 - head/usr.bin/netstat 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: Fri, 17 Oct 2008 21:14:51 -0000 Author: delphij Date: Fri Oct 17 21:14:50 2008 New Revision: 183988 URL: http://svn.freebsd.org/changeset/base/183988 Log: Use strlcpy() when we mean it. Modified: head/usr.bin/netstat/inet.c head/usr.bin/netstat/route.c Modified: head/usr.bin/netstat/inet.c ============================================================================== --- head/usr.bin/netstat/inet.c Fri Oct 17 21:11:09 2008 (r183987) +++ head/usr.bin/netstat/inet.c Fri Oct 17 21:14:50 2008 (r183988) @@ -1145,8 +1145,7 @@ inetname(struct in_addr *inp) if (inp->s_addr == INADDR_ANY) strcpy(line, "*"); else if (cp) { - strncpy(line, cp, sizeof(line) - 1); - line[sizeof(line) - 1] = '\0'; + strlcpy(line, cp, sizeof(line)); } else { inp->s_addr = ntohl(inp->s_addr); #define C(x) ((u_int)((x) & 0xff)) Modified: head/usr.bin/netstat/route.c ============================================================================== --- head/usr.bin/netstat/route.c Fri Oct 17 21:11:09 2008 (r183987) +++ head/usr.bin/netstat/route.c Fri Oct 17 21:14:50 2008 (r183988) @@ -836,8 +836,7 @@ routename(in_addr_t in) } } if (cp) { - strncpy(line, cp, sizeof(line) - 1); - line[sizeof(line) - 1] = '\0'; + strlcpy(line, cp, sizeof(line)); } else { #define C(x) ((x) & 0xff) in = ntohl(in); @@ -902,8 +901,7 @@ netname(in_addr_t in, u_long mask) } } if (cp != NULL) { - strncpy(line, cp, sizeof(line) - 1); - line[sizeof(line) - 1] = '\0'; + strlcpy(line, cp, sizeof(line)); } else { inet_ntop(AF_INET, &in, line, sizeof(line) - 1); }