NetBSD Problem Report #120

Date: Fri, 11 Feb 1994 11:20:02 -0800
From: Havard Eidnes <Havard.Eidnes@runit.sintef.no>
Reply-To: Havard Eidnes <Havard.Eidnes@runit.sintef.no>
To: gnats-admin
Cc: gnats-admin, netbsd-bugs
Subject: bin/120: "su -" buglet when empty "shell" field in passwd

>Number:         120
>Category:       bin
>Synopsis:       "su -" dumps core if the shell field in /etc/passwd is empty
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    gnats-admin
>State:          closed
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Fri Feb 11 11:20:02 +0000 1994
>Closed-Date:    Thu Feb 24 01:31:34 +0000 1994
>Last-Modified:  
>Originator:     Havard Eidnes
>Release:        NetBSD-current
>Organization:
"	SINTEF RUNIT"
>Environment:
	i386, NetBSD-current
System: NetBSD rype.runit.sintef.no 0.9a RYPE#35 i386


>Description:
	"su -" dumps core if the shell field in /etc/passwd is empty
>How-To-Repeat:
	"su - toor" with the original entry in /etc/passwd
>Fix:

See to it that avshell will be computed in every instance,
avoiding a core dump later when it is passed as an argument to
strcat().  The following diff is the cleanest fix I could think of,
offhand.

*** su.c.old	Sat Jan  8 11:55:42 1994
--- su.c	Fri Feb 11 20:04:56 1994
***************
*** 196,207 ****
  	}

! 	/* if we're forking a csh, we want to slightly muck the args */
! 	if (iscsh == UNSET) {
! 		if (p = rindex(shell, '/'))
! 			avshell = p+1;
! 		else
! 			avshell = shell;
! 		iscsh = strcmp(avshell, "csh") ? NO : YES;
! 	}

  	/* set permissions */
--- 196,205 ----
  	}

! 	/* we want to slightly muck the args */
! 	if (p = rindex(shell, '/'))
! 		avshell = p+1;
! 	else
! 		avshell = shell;
! 	iscsh = strcmp(avshell, "csh") ? NO : YES;

  	/* set permissions */
>Release-Note:
>Audit-Trail:
State-Changed-From-To: open->closed 
State-Changed-By: cgd 
State-Changed-When: Wed Feb 23 17:31:34 PST 1994 
State-Changed-Why:  
from su.c: 
revision 1.9 
date: 1994/02/12 07:06:07;  author: cgd;  state: Exp;  lines: +7 -7 
fix bin/120: "su -" buglet when empty "shell" field in passwd 
>Unformatted:

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.51 2026/08/10 02:28:17 riastradh Exp $
$NetBSD: gnats_config.sh,v 1.10 2026/05/13 22:00:09 riastradh Exp $
Copyright © 1994-2026 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.