aboutsummaryrefslogtreecommitdiff
path: root/fs/udf/dir.c
diff options
context:
space:
mode:
authorJan Kara <jack@suse.cz>2014-12-18 22:37:50 +0100
committerMister Oyster <oysterized@gmail.com>2017-04-16 15:03:44 +0200
commitdc9e83cd8b989e546734402ac7dbcfa09edf54b2 (patch)
tree6c3157f394c2f856fb221e872c2408202833190d /fs/udf/dir.c
parent01be8291f7254f058675a12c11b8a131a9f16d4b (diff)
BACKPORT: udf: Check path length when reading symlink
Symlink reading code does not check whether the resulting path fits into the page provided by the generic code. This isn't as easy as just checking the symlink size because of various encoding conversions we perform on path. So we have to check whether there is still enough space in the buffer on the fly. Upstream commit: 0e5cc9a40ada6046e6bc3bdfcd0c0d7e4b706b14 CC: stable@vger.kernel.org Reported-by: Carl Henrik Lunde <chlunde@ping.uio.no> Signed-off-by: Jan Kara <jack@suse.cz>
Diffstat (limited to 'fs/udf/dir.c')
-rw-r--r--fs/udf/dir.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/fs/udf/dir.c b/fs/udf/dir.c
index b3e93f5e1..294c10c84 100644
--- a/fs/udf/dir.c
+++ b/fs/udf/dir.c
@@ -163,7 +163,10 @@ static int do_udf_readdir(struct inode *dir, struct file *filp,
struct kernel_lb_addr tloc = lelb_to_cpu(cfi.icb.extLocation);
iblock = udf_get_lb_pblock(dir->i_sb, &tloc, 0);
- flen = udf_get_filename(dir->i_sb, nameptr, fname, lfi);
+ flen = udf_get_filename(dir->i_sb, nameptr, lfi, fname,
+ UDF_NAME_LEN);
+ if (!flen)
+ continue;
dt_type = DT_UNKNOWN;
}