From: Michael Kerrisk <mtk.manpages-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
To: Peter LaDow <petela-OhJBICGVGq3cUClb0tpMAg@public.gmane.org>
Cc: mtk.manpages-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org,
linux-man-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Subject: Re: [PATCH] execve: Add envp to the Linux notes about NULL pointers
Date: Fri, 21 Jun 2013 14:25:48 +0200 [thread overview]
Message-ID: <51C4464C.5010605@gmail.com> (raw)
In-Reply-To: <CAN8Q1EdfNEyYMoMwu95ROZOCLg6t7ncQudqpV5c02n7H-073mA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
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-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
prev parent reply other threads:[~2013-06-21 12:25 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-06-13 18:37 [PATCH] execve: Add envp to the Linux notes about NULL pointers Peter LaDow
[not found] ` <CAN8Q1EdfNEyYMoMwu95ROZOCLg6t7ncQudqpV5c02n7H-073mA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2013-06-21 12:25 ` Michael Kerrisk [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=51C4464C.5010605@gmail.com \
--to=mtk.manpages-re5jqeeqqe8avxtiumwx3w@public.gmane.org \
--cc=linux-man-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=petela-OhJBICGVGq3cUClb0tpMAg@public.gmane.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).