NetBSD Problem Report #139
From gnats Thu Feb 24 22:17:49 1994
Received: from nic.near.net (nic.near.net [192.52.71.4]) by sun-lamp.cs.berkeley.edu (8.6.5/8.6.5) with SMTP id WAA00951 for <gnats-bugs@sun-lamp.cs.berkeley.edu>; Thu, 24 Feb 1994 22:17:48 -0800
Message-Id: <9402250616.AA09718@cthulhu>
Date: Fri, 25 Feb 94 01:16:22 EST
From: Mike Long <mike.long@analog.com>
Reply-To: Mike Long <Mike.Long@analog.com>
To: gnats-bugs@sun-lamp.cs.berkeley.edu
Subject: 'su - games' as root segfaults
X-Send-Pr-Version: 3.2
>Number: 139
>Category: bin
>Synopsis: 'su - games' as root segfaults
>Confidential: no
>Severity: non-critical
>Priority: low
>Responsible: gnats-admin
>State: closed
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Thu Feb 24 22:20:01 +0000 1994
>Closed-Date: Fri Feb 25 06:32:49 +0000 1994
>Last-Modified: Thu Jan 02 18:11:59 +0000 2014
>Originator: Mike Long
>Release: NetBSD-current 12/6/94
>Organization:
Yeah, right.
>Environment:
System: NetBSD azathoth.boston.ma.us 0.9a AZATHOTH#0 i386
su.c: $Id: su.c,v 1.8 1994/01/07 16:05:42 mycroft Exp $
>Description:
Executing 'su - games' as root causes a segmentation fault when user
'games' has an empty login shell field in /etc/passwd. The variable
iscsh in su.c is set to NO, and consequently avshell is never set.
The call to strcpy() that follows tries to copy from avshell,
dereferences the null pointer and BOOM!
>How-To-Repeat:
su - games
>Fix:
*** su.c~ Sat Jan 8 05:55:42 1994
--- su.c Fri Feb 25 00:35:45 1994
***************
*** 203,208 ****
--- 203,210 ----
avshell = shell;
iscsh = strcmp(avshell, "csh") ? NO : YES;
}
+ else
+ avshell = shell;
/* set permissions */
if (setgid(pwd->pw_gid) < 0) {
>Release-Note:
>Audit-Trail:
State-Changed-From-To: open->closed
State-Changed-By: cgd
State-Changed-When: Thu Feb 24 22:32:49 PST 1994
State-Changed-Why:
fixed on 2/12 (grr).
>Unformatted:
(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.