From 06bb3d2d2e728e76f70cb20dfb903b24cd343de6 Mon Sep 17 00:00:00 2001 From: Tyler Hicks Date: Wed, 28 Jan 2009 09:12:48 -0600 Subject: [PATCH] [eCryptfs] Regression in unencrypted filename symlinks The addition of filename encryption caused a regression in symlinks when filename encryption is not being used. readlink() returned n chars, while strlen() on the returned symlink target reported n - 1 chars. Most applications didn't notice since the extra char was '/0', but a version control system (bzr) caught the bug. Signed-off-by: Tyler Hicks --- fs/ecryptfs/crypto.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff --git a/fs/ecryptfs/crypto.c b/fs/ecryptfs/crypto.c index c01e043..f6caeb1 100644 --- a/fs/ecryptfs/crypto.c +++ b/fs/ecryptfs/crypto.c @@ -1716,7 +1716,7 @@ static int ecryptfs_copy_filename(char **copied_name, size_t *copied_name_size, { int rc = 0; - (*copied_name) = kmalloc((name_size + 2), GFP_KERNEL); + (*copied_name) = kmalloc((name_size + 1), GFP_KERNEL); if (!(*copied_name)) { rc = -ENOMEM; goto out; @@ -1726,7 +1726,7 @@ static int ecryptfs_copy_filename(char **copied_name, size_t *copied_name_size, * in printing out the * string in debug * messages */ - (*copied_name_size) = (name_size + 1); + (*copied_name_size) = name_size; out: return rc; } -- 1.5.3.7