Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 15 Nov 2012 15:06:18 +0000 (UTC)
From:      Eitan Adler <eadler@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r243081 - head/usr.bin/chpass
Message-ID:  <201211151506.qAFF6IBk004078@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: eadler
Date: Thu Nov 15 15:06:18 2012
New Revision: 243081
URL: http://svnweb.freebsd.org/changeset/base/243081

Log:
  Avoid possible null deref if ypclnt_new returns null
  
  PR:		bin/172979
  Submitted by:	Erik Cederstrand <erik@cederstrand.dk>
  Approved by:	cperciva
  MFC after:	3 days

Modified:
  head/usr.bin/chpass/chpass.c

Modified: head/usr.bin/chpass/chpass.c
==============================================================================
--- head/usr.bin/chpass/chpass.c	Thu Nov 15 15:06:15 2012	(r243080)
+++ head/usr.bin/chpass/chpass.c	Thu Nov 15 15:06:18 2012	(r243081)
@@ -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?201211151506.qAFF6IBk004078>