Subject: port-i386/3081: chpass,chfn,etc segfault when run
To: None <gnats-bugs@gnats.netbsd.org>
From: Todd Kover <kovert@omniscient.com>
List: netbsd-bugs
Date: 01/05/1997 02:53:45
>Number:         3081
>Category:       port-i386
>Synopsis:       chpass,chfn,etc segfault when run
>Confidential:   no
>Severity:       critical
>Priority:       medium
>Responsible:    gnats-admin (GNATS administrator)
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sun Jan  5 00:35:01 1997
>Last-Modified:
>Originator:     Todd Kover
>Organization:
Todd Kover                 //  --o-- 
kovert@omniscient.com    \X/     O-   "Beware the fury of a patient man."
http://www.umiacs.umd.edu/~kovert    
							Who is John Galt?
>Release:        19970105
>Environment:
	
System: NetBSD goofball.omniscient.com 1.2B NetBSD 1.2B (GOOFBALL) #32: Wed Jan 1 15:23:55 EST 1997 kovert@goofball.omniscient.com:/usr/src/src/sys/arch/i386/compile/GOOFBALL i386


>Description:
	chpass && chfn segfaults when it's run for user or others (as root)
>How-To-Repeat:
	run one of them, watch
>Fix:
	a pointer is checked for NULL, and if it's NULL is then used; ==
	needs to be changed to !=  (pretty simple.  :)

Index: chpass.c
===================================================================
RCS file: /fs/cvs/master/src/usr.bin/chpass/chpass.c,v
retrieving revision 1.1.1.4
diff -c -r1.1.1.4 chpass.c
*** chpass.c	1996/11/30 23:42:43	1.1.1.4
--- chpass.c	1997/01/05 06:57:27
***************
*** 182,188 ****
  #endif
  
  	if (op == EDITENTRY || op == NEWSH) {
! 		if (username == NULL) {
  #ifdef YP
  			if (use_yp)
  				pw = ypgetpwnam(username);
--- 182,188 ----
  #endif
  
  	if (op == EDITENTRY || op == NEWSH) {
! 		if (username != NULL) {
  #ifdef YP
  			if (use_yp)
  				pw = ypgetpwnam(username);
>Audit-Trail:
>Unformatted: