Bug 15351

Summary: latest 1.36.0 `sh -i` without tty segfaults
Product: Busybox Reporter: Thiner Logoer <logoerthiner1>
Component: OtherAssignee: unassigned
Status: NEW ---    
Severity: major CC: busybox-cvs
Priority: P5    
Version: unspecified   
Target Milestone: ---   
Hardware: All   
OS: Linux   
Host: Target:
Build:

Description Thiner Logoer 2023-02-24 05:36:06 UTC
A quick way to check whether a busybox version has this bug:

```
user@~ $ docker pull busybox
Using default tag: latest
latest: Pulling from library/busybox
Digest: sha256:7b3ccabffc97de872a30dfd234fd972a66d247c8cfc69b0550f276481852627c
Status: Image is up to date for busybox:latest
docker.io/library/busybox:latest
user@~ $ docker run -ti --rm busybox sh
/ # 
/ # cat | sh -i

Segmentation fault (core dumped)
[1]+  Stopped (tty input)        cat | sh -i
/ # fg
cat | sh -i
```

This bug appears both in my manually compiled version and in docker shipped version, so it is not related to specific compiler or configs.

It seems that `sh -i` assumes stdin is a tty and will segfault when it is not. This bug does not appear in 1.35.0 but shows in 1.36.0 .