This is the mail archive of the cygwin-patches@cygwin.com mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: case-sensitiveness of environment problem


On Tue, Apr 17, 2001 at 08:52:27PM +0400, egor duda wrote:
>Hi!
>
>Tuesday, 17 April, 2001 Christopher Faylor cgf@redhat.com wrote:
>
>>>>>  if cygwin environment contains both 'Path' and 'PATH', creating
>>>>>windows environment from it causes crash due to reallocating memory
>>>>>object which is externally referenced. this patch fixes that.
>>>>>
>>>>>i feel that we need a bit more tweaking with environment to deal with
>>>>>it case-insensitiveness under win32.
>>>
>>>CF> I don't think that this is due to case insensitivity as much as someone
>>>CF> supplying a non-malloced PATH string.
>>>
>>>it is. suppose we have cygwin environment containing
>>>
>>>Path=/bin
>>>PATH=/bin:/usr/bin:/usr/local/bin:/home/user/bla/bla/bla
>
>CF> You're right.  I really should have looked at the code more closely.
>
>CF> I think we can solve this trivially by making getwinenv perform a
>CF> case-sensitive comparison, though, can't we?  I think it probably should
>CF> be case-sensitive anyway.
>
>probably. but what if someone runs something nasty like this?
>
>extern char** environ;
>
>char* x[]= { "FOO=bar",
>             "foo=BAR",
>             "FOO=very-long-environment-value-used-only-for-testing-purposes",
>             0 };
>char* arg[] = { "/bin/env", 0 };
>
>int
>main (int argc, char** argv)
>{
>  environ = x;
>  execvp ( arg[0], arg );
>}
>
>i think external reference is a bad idea anyway.

I've always thought that if someone plays with environ they get what they pay
for anyway.

cgf


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]