From: jim owens <jowens@hp.com>
To: Josef Bacik <jbacik@redhat.com>
Cc: linux-btrfs <linux-btrfs@vger.kernel.org>
Subject: Re: [PATCH] Btrfs: support security xattr with SELinux enabled
Date: Wed, 07 Jan 2009 19:22:58 -0500 [thread overview]
Message-ID: <49654762.5050308@hp.com> (raw)
In-Reply-To: <20090107204846.GG5266@unused.rdu.redhat.com>
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.
jim
next prev parent reply other threads:[~2009-01-08 0:22 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 [this message]
2009-01-08 0:47 ` Josef Bacik
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=49654762.5050308@hp.com \
--to=jowens@hp.com \
--cc=jbacik@redhat.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