From: Stephen Smalley <sds@tycho.nsa.gov>
To: Alice Chu <alice.chu@sta.samsung.com>
Cc: "selinux@tycho.nsa.gov" <selinux@tycho.nsa.gov>,
"seandroid-list@tycho.nsa.gov" <seandroid-list@tycho.nsa.gov>
Subject: Re: Fixing external/checkpolicy issues found by Klocwork
Date: Tue, 08 Jan 2013 10:07:48 -0500 [thread overview]
Message-ID: <50EC3644.2000600@tycho.nsa.gov> (raw)
In-Reply-To: <C1432A7484D61749AF22A060C2B03C5D1632046A18@StaEx7mb3.telecom.sna.samsung.com>
On 01/07/2013 08:29 PM, Alice Chu wrote:
> Hello,
>
> Attached you will find the Klocwork report on seandroid master branch external/checkpolicy. The following is the fix for issues found in policy_define.c.
> Please review and give me your feedback.
>
> Thank you very much,
> Alice Chu
>
> ============================================================================
>>From 18555451c5831fd95044e665d3dc514eb69e3b75 Mon Sep 17 00:00:00 2001
> From: Alice Chu <alice.chu@sta.samsung.com>
> Date: Mon, 7 Jan 2013 15:29:29 -0800
> Subject: [PATCH] Fix issues found by Klocwork
>
> Change-Id: Ic3a01364b6855529f6b58a8820c6011a22c21841
> ---
> policy_define.c | 24 +++++++++++++++++++-----
> 1 files changed, 19 insertions(+), 5 deletions(-)
>
> diff --git a/policy_define.c b/policy_define.c
> index 2c12447..504af69 100644
> --- a/policy_define.c
> +++ b/policy_define.c
> @@ -3583,6 +3591,11 @@ static int parse_security_context(context_struct_t * c)
> }
>
> context_init(c);
> + /* check context c to make sure ok to dereference c later */
> + if (c == NULL) {
> + yyerror("null context pointer!");
> + goto bad;
> + }
>
> /* extract the user */
> id = queue_remove(id_queue);
I think you want this check before context_init(), as it dereferences c.
And then just return -1 in the error path.
This btw is an illegal state as NULL should only be passed if pass == 1.
--
This message was distributed to subscribers of the selinux mailing list.
If you no longer wish to subscribe, send mail to majordomo@tycho.nsa.gov with
the words "unsubscribe selinux" without quotes as the message.
next prev parent reply other threads:[~2013-01-08 15:07 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-01-08 1:29 Fixing external/checkpolicy issues found by Klocwork Alice Chu
2013-01-08 15:07 ` Stephen Smalley [this message]
2013-01-08 15:21 ` Eric Paris
2013-01-09 0:20 ` Alice Chu
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=50EC3644.2000600@tycho.nsa.gov \
--to=sds@tycho.nsa.gov \
--cc=alice.chu@sta.samsung.com \
--cc=seandroid-list@tycho.nsa.gov \
--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.