Skip to content

Commit

Permalink
udf: Fix uninitialized array access for some pathnames
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
jankara committed Jun 21, 2023
1 parent 404615d commit 028f605
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion fs/udf/unicode.c
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit 028f605

Please sign in to comment.