Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 23 Oct 2012 10:23:06 GMT
From:      Erik Cederstrand <erik@cederstrand.dk>
To:        freebsd-gnats-submit@FreeBSD.org
Subject:   misc/172979: chpass: Fix null pointer dereference
Message-ID:  <201210231023.q9NAN6XV091771@red.freebsd.org>
Resent-Message-ID: <201210231030.q9NAU10e074257@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help

>Number:         172979
>Category:       misc
>Synopsis:       chpass: Fix null pointer dereference
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Tue Oct 23 10:30:01 UTC 2012
>Closed-Date:
>Last-Modified:
>Originator:     Erik Cederstrand
>Release:        CURRENT
>Organization:
>Environment:
>Description:
Fix a null pointer dereference when ypclnt is NULL
>How-To-Repeat:

>Fix:
Break the condition into two parts.

Patch attached with submission follows:

Index: head/usr.bin/chpass/chpass.c
===================================================================
--- head/usr.bin/chpass/chpass.c	(revision 241876)
+++ head/usr.bin/chpass/chpass.c	(working copy)
@@ -241,8 +241,9 @@
 #ifdef YP
 	case _PWF_NIS:
 		ypclnt = ypclnt_new(yp_domain, "passwd.byname", yp_host);
-		if (ypclnt == NULL ||
-		    ypclnt_connect(ypclnt) == -1 ||
+		if (ypclnt == NULL)
+			exit(1);
+		if (ypclnt_connect(ypclnt) == -1 ||
 		    ypclnt_passwd(ypclnt, pw, password) == -1) {
 			warnx("%s", ypclnt->error);
 			ypclnt_free(ypclnt);

>Release-Note:
>Audit-Trail:
>Unformatted:



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