Problem with setuid/execv on Cygwin/Windows 7

Corinna Vinschen corinna-cygwin@cygwin.com
Fri Nov 9 09:09:00 GMT 2012


On Nov  9 08:59, Laurent Cocault wrote:
> Hi Cygwin community,
> 
> I am currently facing a problem with the combination of setuid/execv on a Cygwin/Windows 7.
> [...]
>     char* args[1];
>     args[0] = NULL;
>     status = execv("/bin/bash", args);

This is wrong.  You should at least set args[0] since that what becomes
argv[0] in the child process:

      char* args[2];
      args[1] = "bash";
      args[2] = NULL;
      status = execv("/bin/bash", args);


Corinna

-- 
Corinna Vinschen                  Please, send mails regarding Cygwin to
Cygwin Project Co-Leader          cygwin AT cygwin DOT com
Red Hat

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple



More information about the Cygwin mailing list