lkml.org 
[lkml]   [2007]   [Dec]   [18]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] ecryptfs: fix string overflow on long cipher names
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,
>
>
>


\
 
 \ /
  Last update: 2007-12-18 17:41    [W:0.047 / U:0.348 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site