From: Josef Bacik <jbacik@redhat.com>
To: jim owens <jowens@hp.com>
Cc: Josef Bacik <jbacik@redhat.com>,
linux-btrfs <linux-btrfs@vger.kernel.org>
Subject: Re: [PATCH] Btrfs: support security xattr with SELinux enabled
Date: Wed, 7 Jan 2009 19:47:29 -0500 [thread overview]
Message-ID: <20090108004728.GJ5266@unused.rdu.redhat.com> (raw)
In-Reply-To: <49654762.5050308@hp.com>
On Wed, Jan 07, 2009 at 07:22:58PM -0500, jim owens wrote:
> Josef Bacik wrote:
>> On Wed, Jan 07, 2009 at 03:19:38PM -0500, jim owens wrote:
>>> +int btrfs_xattr_security_init(struct inode *inode, struct inode *dir)
>>> +{
>>> + int err;
>>> + size_t len;
>>> + void *value;
>>> + char *suffix;
>>> + char *name;
>>> +
>>> + err = security_inode_init_security(inode, dir, &suffix, &value, &len);
>>> + if (err) {
>>> + if (err == -EOPNOTSUPP)
>>> + return 0;
>>> + return err;
>>> + }
>>> +
>>> + name = kmalloc(XATTR_SECURITY_PREFIX_LEN + strlen(suffix) + 1,
>>> + GFP_NOFS);
>>
>> Use kzalloc here otherwise the end of name could be some random thing and
>> strlen() will read past the end of the memory. Thanks,
>
> I don't understand what you think can happen...
>
> + strcpy(name, XATTR_SECURITY_PREFIX);
> + strcpy(name + XATTR_SECURITY_PREFIX_LEN, suffix);
>
> always forces "name" to be \0 terminated.
>
Oh derr sorry I forget suffix is \0 terminated. Nevermind.
Josef
prev parent reply other threads:[~2009-01-08 0:47 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-01-07 20:19 [PATCH] Btrfs: support security xattr with SELinux enabled jim owens
2009-01-07 20:48 ` Josef Bacik
2009-01-08 0:22 ` jim owens
2009-01-08 0:47 ` Josef Bacik [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=20090108004728.GJ5266@unused.rdu.redhat.com \
--to=jbacik@redhat.com \
--cc=jowens@hp.com \
--cc=linux-btrfs@vger.kernel.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