Subject: bin/11847: init(8) mishandles EOF at altshell prompt
To: None <gnats-bugs@gnats.netbsd.org>
From: Ben Harris <bjh21@netbsd.org>
List: netbsd-bugs
Date: 12/30/2000 04:38:13
>Number:         11847
>Category:       bin
>Synopsis:       init(8) mishandles EOF at altshell prompt
>Confidential:   no
>Severity:       non-critical
>Priority:       high
>Responsible:    bin-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sat Dec 30 04:38:01 PST 2000
>Closed-Date:
>Last-Modified:
>Originator:     Ben Harris
>Release:        2000-12-29
>Organization:
>Environment:
NetBSD/arm26 1.5P

>Description:
Pressing ctrl-D at the init "Enter pathname of shell or RETURN for
sh:" prompt causes it to emit the odd message "can't exec rm2 for single
user".  It looks like single_user() calls fgets to read the name of the
shell, but doesn't check for a NULL return.  When faced with EOF, fgets
returns NULL and doesn't modify the input string, so init gets whatever
was left on the stack.

>How-To-Repeat:
Boot single user.
Press ctrl-D at the prompt.

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