Environment handling broken in /bin/sh with changes to {get,set,put}env()

Andrey Chernov ache at nagual.pp.ru
Wed Jul 4 14:36:45 UTC 2007


On Wed, Jul 04, 2007 at 03:53:41PM +0200, Michal Mertl wrote:
> I have tracked it down to the changes in {get,set,put}env and
> src/bin/sh/var.c 1.36. I have checked (by inserting printf just before
> the call) that the arguments passed to putenv() in var.c are reasonable,
> yet the above mentioned warning is issued.

1) I don't check it yet, but there is no putenv() calls in var.c 1.36 in 
anycase.

2) "s" may point to getenv()-provided value there. So just modifying it 
directly followed by setenv() call will make things inconsistent.

3) In my version of patch there was savestr() which copy arg to avoid this 
situation.

Fix will be to restore var.c to mine variant 1.34

-- 
http://ache.pp.ru/


More information about the freebsd-current mailing list