bug-bash
[Top][All Lists]
Advanced

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

Re: [PATCH] Fix null environ crash in getenv() provided by lib/sh/getenv


From: Chet Ramey
Subject: Re: [PATCH] Fix null environ crash in getenv() provided by lib/sh/getenv.c
Date: Mon, 9 Jul 2018 10:16:12 -0400
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:52.0) Gecko/20100101 Thunderbird/52.9.0

On 7/8/18 7:21 AM, Keeley Hoek wrote:
> In running bash on an embedded target, bash crashes for the silly
> reason that environ is NULL.
> 
> I haven't been able to tell whether this is actually permitted by the
> standard (as if?), but in bash I think this behavior is inconsistent
> anyway because:

It's probably permitted by the standard simply because the standard doesn't
specify the value of environ. As a practical matter, on Unix systems, even
when execve() is supplied a NULL third argument, environ is never null.
It's not unreasonable to check for it, though.

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



reply via email to

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