Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > gnu.bash.bug > #14301 > unrolled thread

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

Started byChet Ramey <chet.ramey@case.edu>
First post2018-07-09 10:16 -0400
Last post2018-07-09 10:16 -0400
Articles 1 — 1 participant

Back to article view | Back to gnu.bash.bug

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: [PATCH] Fix null environ crash in getenv() provided by lib/sh/getenv.c Chet Ramey <chet.ramey@case.edu> - 2018-07-09 10:16 -0400

#14301 — Re: [PATCH] Fix null environ crash in getenv() provided by lib/sh/getenv.c

FromChet Ramey <chet.ramey@case.edu>
Date2018-07-09 10:16 -0400
SubjectRe: [PATCH] Fix null environ crash in getenv() provided by lib/sh/getenv.c
Message-ID<mailman.3309.1531145770.1292.bug-bash@gnu.org>
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    chet@case.edu    http://tiswww.cwru.edu/~chet/

[toc] | [standalone]


Back to top | Article view | gnu.bash.bug


csiph-web