All of lore.kernel.org
 help / color / mirror / Atom feed
From: Stephen Smalley <sds@tycho.nsa.gov>
To: Daniel Cashman <dcashman@android.com>, selinux@tycho.nsa.gov
Subject: Re: [PATCH 1/2] libselinux: procattr: return error on invalid pid_t input.
Date: Wed, 24 Feb 2016 09:21:01 -0500	[thread overview]
Message-ID: <56CDBC4D.4060109@tycho.nsa.gov> (raw)
In-Reply-To: <1456259040-13721-2-git-send-email-dcashman@android.com>

On 02/23/2016 03:23 PM, Daniel Cashman wrote:
> From: dcashman <dcashman@android.com>
>
> Signed-off-by: Daniel Cashman <dcashman@android.com>

Thanks, applied.

> ---
>   libselinux/src/procattr.c | 7 +++++--
>   1 file changed, 5 insertions(+), 2 deletions(-)
>
> diff --git a/libselinux/src/procattr.c b/libselinux/src/procattr.c
> index 527a0a5..c20f003 100644
> --- a/libselinux/src/procattr.c
> +++ b/libselinux/src/procattr.c
> @@ -70,9 +70,9 @@ static int openattr(pid_t pid, const char *attr, int flags)
>   	char *path;
>   	pid_t tid;
>
> -	if (pid > 0)
> +	if (pid > 0) {
>   		rc = asprintf(&path, "/proc/%d/attr/%s", pid, attr);
> -	else {
> +	} else if (pid == 0) {
>   		rc = asprintf(&path, "/proc/thread-self/attr/%s", attr);
>   		if (rc < 0)
>   			return -1;
> @@ -82,6 +82,9 @@ static int openattr(pid_t pid, const char *attr, int flags)
>   		free(path);
>   		tid = gettid();
>   		rc = asprintf(&path, "/proc/self/task/%d/attr/%s", tid, attr);
> +	} else {
> +		errno = EINVAL;
> +		return -1;
>   	}
>   	if (rc < 0)
>   		return -1;
>

      parent reply	other threads:[~2016-02-24 14:21 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-02-23 20:23 [PATCH 0/2] Return error on invalid pids for procattr funcs Daniel Cashman
2016-02-23 20:23 ` [PATCH 1/2] libselinux: procattr: return error on invalid pid_t input Daniel Cashman
2016-02-23 20:24   ` [PATCH 2/2] libselinux: procattr: return einval for <= 0 pid args Daniel Cashman
2016-02-23 20:29     ` Daniel Cashman
2016-02-23 21:22       ` Nick Kralevich
2016-02-29 17:38         ` Stephen Smalley
2016-02-24 14:49     ` getpidcon with pid == 0 (Was: Re: [PATCH 2/2] libselinux: procattr: return einval for <= 0 pid args.) Stephen Smalley
2016-02-24 15:25       ` Nick Kralevich
2016-02-24 15:32         ` Stephen Smalley
2016-02-24 16:47           ` Petr Lautrbach
2016-02-24 14:21   ` Stephen Smalley [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=56CDBC4D.4060109@tycho.nsa.gov \
    --to=sds@tycho.nsa.gov \
    --cc=dcashman@android.com \
    --cc=selinux@tycho.nsa.gov \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.