Re: [PATCH] execve: Add envp to the Linux notes about NULL pointers

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 06/13/13 20:37, Peter LaDow wrote:
> This is my first patch submission.  I've tried to follow the
> directions found at https://www.kernel.org/doc/man-pages/patches.html,
> but if I've screwed things up, please let me know.
> 
> During the review of static analysis results, we discovered a
> functional, but non-portable, use of execve().  For example:
> 
>   char *cmd[] = { "/path/to/some/file", NULL };
>   execve(cmd[0], cmd, NULL);
> 
> The call succeeds.  Yet, the static analysis tool (rightly) pointed
> out that envp could be dereferenced.  But digging into glibc and the
> kernel, it appears that like argv, envp when NULL is treated as if it
> were an empty list.
> 
> So, to clear things up, I'm submitting this patch to update the man
> page to indicate that envp is treated like argv.
> 
> I generated the below patch from git after pulling the latest.  I hope
> there is sufficient information in the patch.

Thanks, Peter. I've applied this patch.

Cheers,

Michael


> ---
>  man2/execve.2 | 6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/man2/execve.2 b/man2/execve.2
> index cc91bff..a0b48fc 100644
> --- a/man2/execve.2
> +++ b/man2/execve.2
> @@ -494,10 +494,12 @@ and white spaces in
>  .I optional-arg
>  are used to delimit the arguments.
> 
> -On Linux,
> +On Linux, either
>  .I argv
> +or
> +.I envp
>  can be specified as NULL,
> -which has the same effect as specifying this argument
> +which has the same effect as specifying these arguments
>  as a pointer to a list containing a single NULL pointer.
>  .B "Do not take advantage of this misfeature!"
>  It is nonstandard and nonportable:
> --
> 1.8.3.1
> 

--
To unsubscribe from this list: send the line "unsubscribe linux-man" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Kernel Documentation]     [Netdev]     [Linux Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux