summaryrefslogtreecommitdiff
path: root/fs/udf/unicode.c
diff options
context:
space:
mode:
authorJan Kara <jack@suse.cz>2023-06-21 12:32:35 +0300
committerJan Kara <jack@suse.cz>2023-06-21 12:53:06 +0300
commit028f6055c912588e6f72722d89c30b401bbcf013 (patch)
tree752a307ccb52d3f6ecf370f21398c243edacac7f /fs/udf/unicode.c
parent404615d7f1dcd4cca200e9a7a9df3a1dcae1dd62 (diff)
downloadlinux-028f6055c912588e6f72722d89c30b401bbcf013.tar.xz
udf: Fix uninitialized array access for some pathnames
For filenames that begin with . and are between 2 and 5 characters long, UDF charset conversion code would read uninitialized memory in the output buffer. The only practical impact is that the name may be prepended a "unification hash" when it is not actually needed but still it is good to fix this. Reported-by: syzbot+cd311b1e43cc25f90d18@syzkaller.appspotmail.com Link: https://lore.kernel.org/all/000000000000e2638a05fe9dc8f9@google.com Signed-off-by: Jan Kara <jack@suse.cz>
Diffstat (limited to 'fs/udf/unicode.c')
-rw-r--r--fs/udf/unicode.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/fs/udf/unicode.c b/fs/udf/unicode.c
index ae6e809fa3aa..32c7f3d27f74 100644
--- a/fs/udf/unicode.c
+++ b/fs/udf/unicode.c
@@ -243,7 +243,7 @@ static int udf_name_from_CS0(struct super_block *sb,
}
if (translate) {
- if (str_o_len <= 2 && str_o[0] == '.' &&
+ if (str_o_len > 0 && str_o_len <= 2 && str_o[0] == '.' &&
(str_o_len == 1 || str_o[1] == '.'))
needsCRC = 1;
if (needsCRC) {