* [PATCH] ecryptfs: fix string overflow on long cipher names
@ 2007-12-18 15:51 Eric Sandeen
2007-12-18 16:28 ` Michael Halcrow
0 siblings, 1 reply; 2+ messages in thread
From: Eric Sandeen @ 2007-12-18 15:51 UTC (permalink / raw)
To: linux-kernel Mailing List, Andrew Morton, Michael Halcrow
Cc: mike, Jarod Wilson
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>
---
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,
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] ecryptfs: fix string overflow on long cipher names
2007-12-18 15:51 [PATCH] ecryptfs: fix string overflow on long cipher names Eric Sandeen
@ 2007-12-18 16:28 ` Michael Halcrow
0 siblings, 0 replies; 2+ messages in thread
From: Michael Halcrow @ 2007-12-18 16:28 UTC (permalink / raw)
To: Eric Sandeen
Cc: linux-kernel Mailing List, Andrew Morton, Michael Halcrow,
Jarod Wilson
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,
>
>
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2007-12-18 16:37 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-12-18 15:51 [PATCH] ecryptfs: fix string overflow on long cipher names Eric Sandeen
2007-12-18 16:28 ` Michael Halcrow
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox