[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Environment handling broken in /bin/sh with changes to {get,set,put}env()
- To: "Sean C. Farley" <scf_(_at_)_FreeBSD_(_dot_)_org>
- Subject: Re: Environment handling broken in /bin/sh with changes to {get,set,put}env()
- From: Andrey Chernov <ache_(_at_)_nagual_(_dot_)_pp_(_dot_)_ru>
- Date: Sat, 14 Jul 2007 00:24:33 +0400
- Cc: freebsd-current <freebsd-current_(_at_)_FreeBSD_(_dot_)_org>
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nagual.pp.ru; s=default; t=1184358274; bh=qqqn3KUQ+hwVHN251k1mH0eddIdgijVEjEKtLM5 A2Fo=; l=997; h=Received:Date:From:To:Cc:Subject:Message-ID: Mail-Followup-To:References:MIME-Version:Content-Type: Content-Disposition:In-Reply-To:User-Agent; b=P4e766jyjWL9Ln9VAgHM a8tRuuLq7/2kZ+dhje/aQtqXLydtvpTdnvByoctAU006AWg0ch2k2GshjRbCCwL8e1r 3+I3OMepkvwaJucIxXosgXS+HD2R8zuFZt/AQwtuss+B4il0o4uVEMvM5IEU4H1kLaM H1YNO7qTs81SFgtgs=
- Mail-followup-to: Andrey Chernov <ache_(_at_)_nagual_(_dot_)_pp_(_dot_)_ru>, "Sean C. Farley" <scf_(_at_)_FreeBSD_(_dot_)_org>, freebsd-current <freebsd-current_(_at_)_FreeBSD_(_dot_)_org>
On Fri, Jul 13, 2007 at 02:39:30PM -0500, Sean C. Farley wrote:
> FreeBSD 6 will also dump if the length of the value was less than or
> equal to "/bin" since it reuses this string. This will core dump:
>
> nenv[0] = "PATH=/bin";
> nenv[1] = NULL;
> environ = nenv;
> setenv("PATH", "/bin", 1);
1) I care in first hand about unsetenv() as my example states. There
nowhere said in the specs that unsetenv() may modify environ _content_,
manpage says about pointers only.
2) That example not fail under FreeBSD 6 but fail under new code:
nenv[0] = "PATH=/bin";
nenv[1] = NULL;
environ = nenv;
setenv("HOME", "/xxx", 1);
(that is because new code will touch "PATH=/bin" string in anycase while
old ones looks for "HOME" only).
The most safest way is do not touch environ content outside of
scope of requested modification. That means I agree that
nenv[0] = "PATH=/bin";
setenv("PATH", "/bin", 1);
may fail, but not about the cases 1) and 2)
--
http://ache.pp.ru/
_______________________________________________
freebsd-current_(_at_)_freebsd_(_dot_)_org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-current
To unsubscribe, send any mail to "freebsd-current-unsubscribe_(_at_)_freebsd_(_dot_)_org"
- References:
- Re: Environment handling broken in /bin/sh with changes to {get,set,put}env()
- Re: Environment handling broken in /bin/sh with changes to {get,set,put}env()
- Re: Environment handling broken in /bin/sh with changes to {get,set,put}env()
- Re: Environment handling broken in /bin/sh with changes to {get,set,put}env()
- Re: Environment handling broken in /bin/sh with changes to {get,set,put}env()
- Re: Environment handling broken in /bin/sh with changes to {get,set,put}env()
- Re: Environment handling broken in /bin/sh with changes to {get,set,put}env()
- Re: Environment handling broken in /bin/sh with changes to {get,set,put}env()
- Re: Environment handling broken in /bin/sh with changes to {get,set,put}env()
- Re: Environment handling broken in /bin/sh with changes to {get,set,put}env()
Visit your host, monkey.org