All of lore.kernel.org
 help / color / mirror / Atom feed
From: Paul Moore <paul.moore@hp.com>
To: Eric Paris <eparis@redhat.com>
Cc: selinux@tycho.nsa.gov, sds@tycho.nsa.gov, jmorris@namei.org
Subject: Re: [PATCH 1/2] SELinux: NULL terminate al contexts from disk
Date: Thu, 12 Feb 2009 15:46:56 -0500	[thread overview]
Message-ID: <200902121546.56758.paul.moore@hp.com> (raw)
In-Reply-To: <20090212195005.25556.94754.stgit@paris.rdu.redhat.com>

On Thursday 12 February 2009 02:50:05 pm Eric Paris wrote:
> @@ -1290,12 +1290,13 @@ static int inode_doinit_with_dentry(struct inode
> *inode, struct dentry *opt_dent }
>
>  		len = INITCONTEXTLEN;
> -		context = kmalloc(len, GFP_NOFS);
> +		context = kmalloc(len+1, GFP_NOFS);
>  		if (!context) {
>  			rc = -ENOMEM;
>  			dput(dentry);
>  			goto out_unlock;
>  		}
> +		context[len] = '\0';
>  		rc = inode->i_op->getxattr(dentry, XATTR_NAME_SELINUX,
>  					   context, len);
>  		if (rc == -ERANGE) {

Perhaps move the "context[len] = '\0';" to just after the getxattr() call?  It 
might help provide a little extra protection in case getxattr() gets a little 
buggy ... then again maybe not, your call.

-- 
paul moore
linux @ hp


--
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.

  parent reply	other threads:[~2009-02-12 20:46 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-02-12 19:50 [PATCH 1/2] SELinux: NULL terminate al contexts from disk Eric Paris
2009-02-12 19:50 ` [PATCH 2/2] SELinux: check seqno when updating an avc_node Eric Paris
2009-02-13 14:07   ` Stephen Smalley
2009-02-13 15:06     ` Eric Paris
2009-02-13 20:19       ` Stephen Smalley
2009-02-13 20:19   ` Stephen Smalley
2009-02-13 22:44   ` James Morris
2009-02-12 20:46 ` Paul Moore [this message]
2009-02-13 13:50 ` [PATCH 1/2] SELinux: NULL terminate al contexts from disk Stephen Smalley
2009-02-13 22:43 ` James Morris

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=200902121546.56758.paul.moore@hp.com \
    --to=paul.moore@hp.com \
    --cc=eparis@redhat.com \
    --cc=jmorris@namei.org \
    --cc=sds@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.