execvp

Mike McNally m5d at bobkat.UUCP
Thu Jan 22 01:21:59 AEST 1987


My 4.2BSD documentation for execl(3) describes a "bug" involving failed
attempts to execute the shell to run a supposed command file.
According to the "man" page,

	If execvp is called to execute a file that turns out to be a 
	shell command file, and if it is impossible to execute the
	shell, the values of argv[0] and argv[-1] will be modified
	before return.

This seemed very strange to me.  Which "argv"?  Why does it mess with
argv[-1]??

I wrote a fake version of execve(2) which prints the address of the
argument list passed to it, then sets "errno" to ENOEXEC and returns.
This fools execvp, which then tries to run the shell.  The argument
list passed the second time is somewhere on the stack; it isn't my
original "argv" at all.

In short I can't cause this "bug" to manifest itself; does it really
exist?

--
****                                                         ****
**** At Digital Lynx, we're almost in Garland, but not quite ****
****                                                         ****

Mike McNally                                    Digital Lynx Inc.
Software (not hardware) Person                  Dallas  TX  75243
uucp: {texsun,killer,infotel}!pollux!bobkat!m5  (214) 238-7474



More information about the Comp.unix.wizards mailing list