From owner-svn-src-head@freebsd.org Sun Mar 12 17:27:15 2017 Return-Path: Delivered-To: svn-src-head@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 C90D7D09475 for ; Sun, 12 Mar 2017 17:27:15 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from nm1-vm0.bullet.mail.ne1.yahoo.com (nm1-vm0.bullet.mail.ne1.yahoo.com [98.138.91.74]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 949BE1858 for ; Sun, 12 Mar 2017 17:27:15 +0000 (UTC) (envelope-from pfg@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1489339628; bh=sHTBfKWy5CSYToi5T/X9RoEXrQJRrx4tKzIcnAXWNPw=; h=Subject:To:References:From:Date:In-Reply-To:From:Subject; b=KFRSz8ZkhcNK0tppXZBRTOdzvYhie0GMOs5W/zVJKEHxVNH0ngK3kduZtyK5BaFsnUCytUjcHVULb6BOjIw3555W+xOwhC8w5gkzu7X8RY0dNn2vjVj1msRNMWsgLGL5FB6F4mVAyVs0mKgRjb3xAkW5EaCtD2528dFFagAYmLMf+/0Tphnv+TetD5ZVovD6NpV+3lh8kSxxbRWwJ9VXi7jifCodQL3yq52WTeneSfF26t2FRCdcuztu7dAhe2a4o9iQFTaHS/++2Px8VdfRnjD8bUnDa/MT6Qlc5kY674sNS/3ntYRGJq+2Tqm6c+SyhgelYohXLhbviKA3EMXGvg== Received: from [98.138.101.131] by nm1.bullet.mail.ne1.yahoo.com with NNFMP; 12 Mar 2017 17:27:08 -0000 Received: from [98.138.226.128] by tm19.bullet.mail.ne1.yahoo.com with NNFMP; 12 Mar 2017 17:27:08 -0000 Received: from [127.0.0.1] by smtp215.mail.ne1.yahoo.com with NNFMP; 12 Mar 2017 17:27:08 -0000 X-Yahoo-Newman-Id: 87942.82415.bm@smtp215.mail.ne1.yahoo.com X-Yahoo-Newman-Property: ymail-3 X-YMail-OSG: zXD0roQVM1mJ6yJh02ZGuIVJ6ZsUBkygbCxTkP6Z85_OykK Cjlum.bfqFNvDQost5qyJCc2wZG7lYh8ODewTNoqzASdEvXCEIxT4SuYBA0m 3h1fbBZ5NVqJOVKmuB6TWU67K9hylQ0ihDndvMXO5zEnH.3WRrZeO9P21tPO 2rg.d2Iln5PcazQ4SWrIjVg_sorgoR5U0UmCDMZ9yrBFKl5t14e4eSmv.xnM 0QfRvzfAEyG.eokZjaU_8sa0ffvHf81o2MDCSfoLCrZ9njon46C0eQGmDxTE lKC_ei79Z2.6Lva7uLDDiGwhve_T38DVHZjjNQ.eBk.BJH0whVshVe_qEqar CWk.GLi84Lr5gku_IKP3AXaAUBpVPx0ifKqRNa6sVKWscXvm6lhTIWVBXrGY DT2cNyy3YVmh585czsEo8tTwoKm3pBwM_V8Uz0wm8tlKQEOmkxDIcFb8C2bg 8H1grv5q257x5K0YXt1tOD8UMpiyXoWYtCHByQIVfWuku1Ta7gkrlGlYdAbi eKfrwdiHbWY_SRYYz.X6CHBQ_qIcJT0Lxx8__k5.ectZRgUA- X-Yahoo-SMTP: xcjD0guswBAZaPPIbxpWwLcp9Unf Subject: Re: svn commit: r314780 - head/lib/libpam/modules/pam_exec To: Lawrence Stewart , src-committers@freebsd.org, =?UTF-8?Q?Dag-Erling_Sm=c3=b8rgrav?= , svn-src-head@freebsd.org References: <201703061545.v26FjkNI027057@repo.freebsd.org> <739617a4-3eed-28d1-73e4-86d25d6d5fed@freebsd.org> From: Pedro Giffuni Message-ID: <1839903b-fb05-bf3f-17bb-697afca9ecb7@FreeBSD.org> Date: Sun, 12 Mar 2017 12:30:14 -0500 User-Agent: Mozilla/5.0 (Windows NT 6.3; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.8.0 MIME-Version: 1.0 In-Reply-To: <739617a4-3eed-28d1-73e4-86d25d6d5fed@freebsd.org> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 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: Sun, 12 Mar 2017 17:27:15 -0000 On 3/12/2017 12:14 PM, Lawrence Stewart wrote: > Hi Pedro, > > On 07/03/2017 02:45, Pedro F. Giffuni wrote: >> Author: pfg >> Date: Mon Mar 6 15:45:46 2017 >> New Revision: 314780 >> URL: https://svnweb.freebsd.org/changeset/base/314780 >> >> Log: >> libpam: extra bounds checking through reallocarray(3). >> >> Reviewed by: des >> MFC after: 1 week >> >> Modified: >> head/lib/libpam/modules/pam_exec/pam_exec.c >> >> Modified: head/lib/libpam/modules/pam_exec/pam_exec.c >> ============================================================================== >> --- head/lib/libpam/modules/pam_exec/pam_exec.c Mon Mar 6 15:42:03 2017 (r314779) >> +++ head/lib/libpam/modules/pam_exec/pam_exec.c Mon Mar 6 15:45:46 2017 (r314780) >> @@ -138,7 +138,7 @@ _pam_exec(pam_handle_t *pamh __unused, >> nitems = sizeof(env_items) / sizeof(*env_items); >> /* Count PAM return values put in the environment. */ >> nitems_rv = options->return_prog_exit_status ? PAM_RV_COUNT : 0; >> - tmp = realloc(envlist, (envlen + nitems + 1 + nitems_rv + 1) * >> + tmp = reallocarray(envlist, envlen + nitems + 1 + nitems_rv + 1, >> sizeof(*envlist)); >> if (tmp == NULL) { >> openpam_free_envlist(envlist); >> > This commit breaks pam_exec for me... without this change I see the > expected PAM_* environment variables from my execed script, but with > this change I no longer see any of them. Thanks for the report. It seems strange this can cause any failure. Perhaps there is a latent overflow here and we have been living with it? I will revert while it is investigated. BTW, the "nitems" variable may conflict with nitems() in sys/param.h. Pedro.