From owner-svn-src-stable-7@FreeBSD.ORG Wed Sep 22 21:43:49 2010 Return-Path: Delivered-To: svn-src-stable-7@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 24AAA1065673; Wed, 22 Sep 2010 21:43:49 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 143FC8FC14; Wed, 22 Sep 2010 21:43:49 +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 o8MLhmN1044579; Wed, 22 Sep 2010 21:43:48 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8MLhma0044577; Wed, 22 Sep 2010 21:43:48 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <201009222143.o8MLhma0044577@svn.freebsd.org> From: Marius Strobl Date: Wed, 22 Sep 2010 21:43:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r213034 - stable/7/usr.bin/tftp X-BeenThere: svn-src-stable-7@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 7-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 22 Sep 2010 21:43:49 -0000 Author: marius Date: Wed Sep 22 21:43:48 2010 New Revision: 213034 URL: http://svn.freebsd.org/changeset/base/213034 Log: MFC: r183857 Use strlcpy() instead of strncpy() when we want the string to be NUL-terminated. Modified: stable/7/usr.bin/tftp/main.c Directory Properties: stable/7/usr.bin/tftp/ (props changed) Modified: stable/7/usr.bin/tftp/main.c ============================================================================== --- stable/7/usr.bin/tftp/main.c Wed Sep 22 21:14:18 2010 (r213033) +++ stable/7/usr.bin/tftp/main.c Wed Sep 22 21:43:48 2010 (r213034) @@ -233,11 +233,10 @@ setpeer0(host, port) /* res->ai_addr <= sizeof(peeraddr) is guaranteed */ memcpy(&peeraddr, res->ai_addr, res->ai_addrlen); if (res->ai_canonname) { - (void) strncpy(hostname, res->ai_canonname, + (void) strlcpy(hostname, res->ai_canonname, sizeof(hostname)); } else - (void) strncpy(hostname, host, sizeof(hostname)); - hostname[sizeof(hostname)-1] = 0; + (void) strlcpy(hostname, host, sizeof(hostname)); connected = 1; }