Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 19 Nov 2012 04:08:20 +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-7@freebsd.org
Subject:   svn commit: r243258 - stable/7/usr.bin/chpass
Message-ID:  <201211190408.qAJ48KrU078123@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: eadler
Date: Mon Nov 19 04:08:20 2012
New Revision: 243258
URL: http://svnweb.freebsd.org/changeset/base/243258

Log:
  MFC r243081:
  	Avoid possible null deref if ypclnt_new returns null
  
  PR:		bin/172979
  Approved by:	cperciva (implicit)

Modified:
  stable/7/usr.bin/chpass/chpass.c
Directory Properties:
  stable/7/usr.bin/chpass/   (props changed)

Modified: stable/7/usr.bin/chpass/chpass.c
==============================================================================
--- stable/7/usr.bin/chpass/chpass.c	Mon Nov 19 04:08:10 2012	(r243257)
+++ stable/7/usr.bin/chpass/chpass.c	Mon Nov 19 04:08:20 2012	(r243258)
@@ -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?201211190408.qAJ48KrU078123>