bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: improper bashrc sourcing with closed stdin


From: Chet Ramey
Subject: Re: improper bashrc sourcing with closed stdin
Date: Sun, 21 Feb 2016 20:48:46 -0500
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.11; rv:38.0) Gecko/20100101 Thunderbird/38.5.1

On 2/20/16 4:25 AM, Andrew Gregory wrote:

> Bash Version: 4.3
> Patch Level: 42
> Release Status: release
> 
> Description:
>     If run non-interactively with stdin closed and SHLVL=0, bash will
>     source ~/.bashrc, due to run_startup_files() thinking that bash is
>     being run by rshd.
> 
> Repeat-By:
> 
> #include <unistd.h>
> #include <stdlib.h>
> 
> void main(void) {
>     close(0);
>     setenv("SHLVL", "0", 1);
>     execl("/bin/bash", "/bin/bash", "-c", "echo foo", NULL);
> }
> 
> Fix:
>     It looks like isnetconn needs to be modified to not count an fd
>     that returns EBADF as a socket:

Thanks for the report and fix.

Chet

-- 
``The lyf so short, the craft so long to lerne.'' - Chaucer
                 ``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, ITS, CWRU    address@hidden    http://cnswww.cns.cwru.edu/~chet/



reply via email to

[Prev in Thread] Current Thread [Next in Thread]