Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 19 Nov 2012 04:07:44 +0000 (UTC)
From:      Eitan Adler <eadler@FreeBSD.org>
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
Message-ID:  <201211190407.qAJ47iG2077940@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
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);



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201211190407.qAJ47iG2077940>