summaryrefslogtreecommitdiff
path: root/fs/udf
diff options
context:
space:
mode:
authorJan Kara <jack@suse.cz>2023-01-25 16:49:00 +0100
committerJan Kara <jack@suse.cz>2023-01-26 16:46:32 +0100
commit3bea4ae1c97bab48bef4b1694915b43a5543c9c7 (patch)
tree946c1a81f5836f93839acc77db24fa6e50ee83b6 /fs/udf
parent7a5fa171a2869e99fe38f61c60274e7b4bf3a5e0 (diff)
udf: Zero udf name padding
Padding of name in the directory entry needs to be zeroed out. Fix it. Signed-off-by: Jan Kara <jack@suse.cz>
Diffstat (limited to 'fs/udf')
-rw-r--r--fs/udf/directory.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/fs/udf/directory.c b/fs/udf/directory.c
index 18a1514871fe..e8cf13214c8c 100644
--- a/fs/udf/directory.c
+++ b/fs/udf/directory.c
@@ -367,6 +367,8 @@ static void udf_copy_fi_to_bufs(char *buf1, int len1, char *buf2, int len2,
int fioff = off;
int crcoff = off + sizeof(struct tag);
unsigned int crclen = udf_dir_entry_len(fi) - sizeof(struct tag);
+ char zeros[UDF_NAME_PAD] = {};
+ int endoff = off + udf_dir_entry_len(fi);
udf_copy_to_bufs(buf1, len1, buf2, len2, off, fi,
sizeof(struct fileIdentDesc));
@@ -375,9 +377,13 @@ static void udf_copy_fi_to_bufs(char *buf1, int len1, char *buf2, int len2,
udf_copy_to_bufs(buf1, len1, buf2, len2, off, impuse,
le16_to_cpu(fi->lengthOfImpUse));
off += le16_to_cpu(fi->lengthOfImpUse);
- if (name)
+ if (name) {
udf_copy_to_bufs(buf1, len1, buf2, len2, off, name,
fi->lengthFileIdent);
+ off += fi->lengthFileIdent;
+ udf_copy_to_bufs(buf1, len1, buf2, len2, off, zeros,
+ endoff - off);
+ }
crc = udf_crc_fi_bufs(buf1, len1, buf2, len2, crcoff, crclen);
fi->descTag.descCRC = cpu_to_le16(crc);