From owner-svn-src-stable-9@FreeBSD.ORG Mon Nov 19 04:07:44 2012 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 5A0B11B6; Mon, 19 Nov 2012 04:07:44 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 3A6808FC08; Mon, 19 Nov 2012 04:07:44 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id qAJ47ioL077941; Mon, 19 Nov 2012 04:07:44 GMT (envelope-from eadler@svn.freebsd.org) Received: (from eadler@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id qAJ47iG2077940; Mon, 19 Nov 2012 04:07:44 GMT (envelope-from eadler@svn.freebsd.org) Message-Id: <201211190407.qAJ47iG2077940@svn.freebsd.org> From: Eitan Adler Date: Mon, 19 Nov 2012 04:07:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r243256 - stable/9/usr.bin/chpass X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Nov 2012 04:07:44 -0000 Author: eadler Date: Mon Nov 19 04:07:43 2012 New Revision: 243256 URL: http://svnweb.freebsd.org/changeset/base/243256 Log: MFC r243081: Avoid possible null deref if ypclnt_new returns null PR: bin/172979 Approved by: cperciva (implicit) Modified: stable/9/usr.bin/chpass/chpass.c Directory Properties: stable/9/usr.bin/chpass/ (props changed) Modified: stable/9/usr.bin/chpass/chpass.c ============================================================================== --- stable/9/usr.bin/chpass/chpass.c Mon Nov 19 01:58:20 2012 (r243255) +++ stable/9/usr.bin/chpass/chpass.c Mon Nov 19 04:07:43 2012 (r243256) @@ -241,8 +241,11 @@ main(int argc, char *argv[]) #ifdef YP case _PWF_NIS: ypclnt = ypclnt_new(yp_domain, "passwd.byname", yp_host); - if (ypclnt == NULL || - ypclnt_connect(ypclnt) == -1 || + if (ypclnt == NULL) { + warnx("ypclnt_new failed"); + exit(1); + } + if (ypclnt_connect(ypclnt) == -1 || ypclnt_passwd(ypclnt, pw, password) == -1) { warnx("%s", ypclnt->error); ypclnt_free(ypclnt);