From owner-svn-src-all@freebsd.org Wed Mar 22 17:49:57 2017 Return-Path: Delivered-To: svn-src-all@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 6CED0D18D8F; Wed, 22 Mar 2017 17:49:57 +0000 (UTC) (envelope-from bdrewery@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 2E1E51758; Wed, 22 Mar 2017 17:49:57 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v2MHnuw8028128; Wed, 22 Mar 2017 17:49:56 GMT (envelope-from bdrewery@FreeBSD.org) Received: (from bdrewery@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v2MHnuoM028127; Wed, 22 Mar 2017 17:49:56 GMT (envelope-from bdrewery@FreeBSD.org) Message-Id: <201703221749.v2MHnuoM028127@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bdrewery set sender to bdrewery@FreeBSD.org using -f From: Bryan Drewery Date: Wed, 22 Mar 2017 17:49:56 +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: r315722 - stable/10/bin/kill X-SVN-Group: stable-10 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.23 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: Wed, 22 Mar 2017 17:49:57 -0000 Author: bdrewery Date: Wed Mar 22 17:49:56 2017 New Revision: 315722 URL: https://svnweb.freebsd.org/changeset/base/315722 Log: MFC r314714: Don't kill pid -1 on overflow from strtol(3). Modified: stable/10/bin/kill/kill.c Directory Properties: stable/10/ (props changed) Modified: stable/10/bin/kill/kill.c ============================================================================== --- stable/10/bin/kill/kill.c Wed Mar 22 17:46:08 2017 (r315721) +++ stable/10/bin/kill/kill.c Wed Mar 22 17:49:56 2017 (r315722) @@ -67,7 +67,9 @@ static void usage(void); int main(int argc, char *argv[]) { - int errors, numsig, pid; + long pidl; + pid_t pid; + int errors, numsig; char *ep; if (argc < 2) @@ -138,8 +140,10 @@ main(int argc, char *argv[]) else #endif { - pid = strtol(*argv, &ep, 10); - if (!**argv || *ep) + pidl = strtol(*argv, &ep, 10); + /* Check for overflow of pid_t. */ + pid = (pid_t)pidl; + if (!**argv || *ep || pid != pidl) errx(2, "illegal process id: %s", *argv); } if (kill(pid, numsig) == -1) {