From owner-freebsd-current Sun Jan 20 11:45:40 2002 Delivered-To: freebsd-current@freebsd.org Received: from nagual.pp.ru (pobrecita.freebsd.ru [194.87.13.42]) by hub.freebsd.org (Postfix) with ESMTP id 4360837B419; Sun, 20 Jan 2002 11:45:14 -0800 (PST) Received: (from ache@localhost) by nagual.pp.ru (8.11.6/8.11.6) id g0KJjCG24135; Sun, 20 Jan 2002 22:45:13 +0300 (MSK) (envelope-from ache) Date: Sun, 20 Jan 2002 22:45:10 +0300 From: "Andrey A. Chernov" To: markm@freebsd.org, des@freebsd.org, current@freebsd.org Subject: Step4, pam_opie getpwnam check fix for review Message-ID: <20020120194510.GA24069@nagual.pp.ru> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.3.24i Sender: owner-freebsd-current@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG Bug: getpwnum() (or getlogin() in earlier stage) may return NULL under various complex circumstanes, but following code not expect it and may cause NULL pointer reference and core dump. Fix: Add check for NULL and return PAM_AUTH_ERR --- pam_opie.c.bak Sun Jan 20 22:23:18 2002 +++ pam_opie.c Sun Jan 20 22:37:08 2002 @@ -89,7 +89,8 @@ user = NULL; if (pam_test_option(&options, PAM_OPT_AUTH_AS_SELF, NULL)) { - pwd = getpwnam(getlogin()); + if ((pwd = getpwnam(getlogin())) == NULL) + PAM_RETURN(PAM_AUTH_ERR); user = pwd->pw_name; } else { -- Andrey A. Chernov http://ache.pp.ru/ To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-current" in the body of the message