public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Michael Halcrow <mike@halcrow.us>
To: Eric Sandeen <sandeen@redhat.com>
Cc: linux-kernel Mailing List <linux-kernel@vger.kernel.org>,
	Andrew Morton <akpm@linux-foundation.org>,
	Michael Halcrow <mhalcrow@us.ibm.com>,
	Jarod Wilson <jwilson@redhat.com>
Subject: Re: [PATCH] ecryptfs: fix string overflow on long cipher names
Date: Tue, 18 Dec 2007 10:28:54 -0600	[thread overview]
Message-ID: <20071218162854.GN13486@halcrow.us> (raw)
In-Reply-To: <4767EC73.2030507@redhat.com>

On Tue, Dec 18, 2007 at 09:51:15AM -0600, Eric Sandeen wrote:
> Passing a cipher name > 32 chars on mount results in an overflow
> when the cipher name is printed, because the last character
> in the struct ecryptfs_key_tfm's cipher_name string was never 
> zeroed.
> 
> Signed-off-by: Eric Sandeen <sandeen@redhat.com>

Acked-by: Michael Halcrow <mhalcrow@us.ibm.com>

I don't think this causes any issues outside of a couple of printk's
on error paths, but this should definitely go into the next -rc.

> ---
> 
> Index: linux-2.6.24-rc3/fs/ecryptfs/crypto.c
> ===================================================================
> --- linux-2.6.24-rc3.orig/fs/ecryptfs/crypto.c
> +++ linux-2.6.24-rc3/fs/ecryptfs/crypto.c
> @@ -1847,6 +1847,7 @@ ecryptfs_add_new_key_tfm(struct ecryptfs
>  	mutex_init(&tmp_tfm->key_tfm_mutex);
>  	strncpy(tmp_tfm->cipher_name, cipher_name,
>  		ECRYPTFS_MAX_CIPHER_NAME_SIZE);
> +	tmp_tfm->cipher_name[ECRYPTFS_MAX_CIPHER_NAME_SIZE] = '\0';
>  	tmp_tfm->key_size = key_size;
>  	rc = ecryptfs_process_key_cipher(&tmp_tfm->key_tfm,
>  					 tmp_tfm->cipher_name,
> 
> 
> 

      reply	other threads:[~2007-12-18 16:37 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-12-18 15:51 [PATCH] ecryptfs: fix string overflow on long cipher names Eric Sandeen
2007-12-18 16:28 ` Michael Halcrow [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=20071218162854.GN13486@halcrow.us \
    --to=mike@halcrow.us \
    --cc=akpm@linux-foundation.org \
    --cc=jwilson@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mhalcrow@us.ibm.com \
    --cc=sandeen@redhat.com \
    /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