From owner-freebsd-bugs@FreeBSD.ORG Tue Oct 23 10:30:02 2012 Return-Path: Delivered-To: freebsd-bugs@hub.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 515999F5 for ; Tue, 23 Oct 2012 10:30:02 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (freefall.FreeBSD.org [8.8.178.135]) by mx1.freebsd.org (Postfix) with ESMTP id 0FD0F8FC18 for ; Tue, 23 Oct 2012 10:30:02 +0000 (UTC) Received: from freefall.freebsd.org (localhost [127.0.0.1]) by freefall.freebsd.org (8.14.5/8.14.5) with ESMTP id q9NAU1u1074260 for ; Tue, 23 Oct 2012 10:30:01 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.14.5/8.14.5/Submit) id q9NAU10e074257; Tue, 23 Oct 2012 10:30:01 GMT (envelope-from gnats) Resent-Date: Tue, 23 Oct 2012 10:30:01 GMT Resent-Message-Id: <201210231030.q9NAU10e074257@freefall.freebsd.org> Resent-From: FreeBSD-gnats-submit@FreeBSD.org (GNATS Filer) Resent-To: freebsd-bugs@FreeBSD.org Resent-Reply-To: FreeBSD-gnats-submit@FreeBSD.org, Erik Cederstrand Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 8046D7C1 for ; Tue, 23 Oct 2012 10:23:06 +0000 (UTC) (envelope-from nobody@FreeBSD.org) Received: from red.freebsd.org (red.freebsd.org [IPv6:2001:4f8:fff6::22]) by mx1.freebsd.org (Postfix) with ESMTP id 690B38FC0C for ; Tue, 23 Oct 2012 10:23:06 +0000 (UTC) Received: from red.freebsd.org (localhost [127.0.0.1]) by red.freebsd.org (8.14.5/8.14.5) with ESMTP id q9NAN6o6091772 for ; Tue, 23 Oct 2012 10:23:06 GMT (envelope-from nobody@red.freebsd.org) Received: (from nobody@localhost) by red.freebsd.org (8.14.5/8.14.5/Submit) id q9NAN6XV091771; Tue, 23 Oct 2012 10:23:06 GMT (envelope-from nobody) Message-Id: <201210231023.q9NAN6XV091771@red.freebsd.org> Date: Tue, 23 Oct 2012 10:23:06 GMT From: Erik Cederstrand To: freebsd-gnats-submit@FreeBSD.org X-Send-Pr-Version: www-3.1 Subject: misc/172979: chpass: Fix null pointer dereference X-BeenThere: freebsd-bugs@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 23 Oct 2012 10:30:02 -0000 >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: