From owner-svn-src-all@freebsd.org Tue Dec 22 15:32:46 2015 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 93245A4F7E5; Tue, 22 Dec 2015 15:32:46 +0000 (UTC) (envelope-from pfg@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 639C71A5B; Tue, 22 Dec 2015 15:32:46 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id tBMFWjG9055175; Tue, 22 Dec 2015 15:32:45 GMT (envelope-from pfg@FreeBSD.org) Received: (from pfg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id tBMFWjiL055174; Tue, 22 Dec 2015 15:32:45 GMT (envelope-from pfg@FreeBSD.org) Message-Id: <201512221532.tBMFWjiL055174@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: pfg set sender to pfg@FreeBSD.org using -f From: "Pedro F. Giffuni" Date: Tue, 22 Dec 2015 15:32:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r292607 - head/usr.sbin/cron/cron 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, 22 Dec 2015 15:32:46 -0000 Author: pfg Date: Tue Dec 22 15:32:45 2015 New Revision: 292607 URL: https://svnweb.freebsd.org/changeset/base/292607 Log: cron: Check the return value of pipe(2) Fix inspired by: OpenBSD (rev 1.56) CID: 1009830 Modified: head/usr.sbin/cron/cron/do_command.c Modified: head/usr.sbin/cron/cron/do_command.c ============================================================================== --- head/usr.sbin/cron/cron/do_command.c Tue Dec 22 15:30:26 2015 (r292606) +++ head/usr.sbin/cron/cron/do_command.c Tue Dec 22 15:32:45 2015 (r292607) @@ -114,7 +114,7 @@ child_process(e, u) struct pam_conv pamc = { .conv = openpam_nullconv, .appdata_ptr = NULL - }; + } Debug(DPROC, ("[%d] checking account with PAM\n", getpid())) @@ -161,8 +161,10 @@ child_process(e, u) /* create some pipes to talk to our future child */ - pipe(stdin_pipe); /* child's stdin */ - pipe(stdout_pipe); /* child's stdout */ + if (pipe(stdin_pipe) != 0 || pipe(stdout_pipe) != 0) { + log_it("CRON", getpid(), "error", "can't pipe"); + exit(ERROR_EXIT); + } /* since we are a forked process, we can diddle the command string * we were passed -- nobody else is going to use it again, right?