From owner-svn-src-all@FreeBSD.ORG Tue May 5 09:26:33 2015 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 7C78C4BC; Tue, 5 May 2015 09:26:33 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::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 6B4431527; Tue, 5 May 2015 09:26:33 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id t459QXd0063670; Tue, 5 May 2015 09:26:33 GMT (envelope-from bapt@FreeBSD.org) Received: (from bapt@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id t459QXdL063669; Tue, 5 May 2015 09:26:33 GMT (envelope-from bapt@FreeBSD.org) Message-Id: <201505050926.t459QXdL063669@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: bapt set sender to bapt@FreeBSD.org using -f From: Baptiste Daroussin Date: Tue, 5 May 2015 09:26:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r282463 - head/usr.bin/checknr X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 05 May 2015 09:26:33 -0000 Author: bapt Date: Tue May 5 09:26:32 2015 New Revision: 282463 URL: https://svnweb.freebsd.org/changeset/base/282463 Log: Use stdup(3) and check its return instead from homebrew version using strcpy(3) and malloc(3) Obtained from: NetBSD Modified: head/usr.bin/checknr/checknr.c Modified: head/usr.bin/checknr/checknr.c ============================================================================== --- head/usr.bin/checknr/checknr.c Tue May 5 09:24:29 2015 (r282462) +++ head/usr.bin/checknr/checknr.c Tue May 5 09:26:32 2015 (r282463) @@ -574,7 +574,8 @@ addmac(const char *mac) dest = src+1; while (dest > loc) *dest-- = *src--; - *loc = strcpy(malloc(3), mac); + if ((*loc = strdup(mac)) == NULL) + err(1, "strdup"); ncmds++; #ifdef DEBUG printf("after: %s %s %s %s %s, %d cmds\n",