summaryrefslogtreecommitdiff
path: root/fs/squashfs
diff options
context:
space:
mode:
authorTom Rini <trini@konsulko.com>2022-06-20 14:40:59 -0400
committerTom Rini <trini@konsulko.com>2022-06-20 14:40:59 -0400
commit52af0101be55da74a32e9b169864508101f886fe (patch)
tree0027962a3a4e43a1e29fa7411934501b75fe811b /fs/squashfs
parent78533a1ce87786d2ba9be70e657b09cded1267e1 (diff)
parent568a226f87655fd5339514f66413c2ad72f65d6f (diff)
downloadu-boot-52af0101be55da74a32e9b169864508101f886fe.tar.gz
u-boot-52af0101be55da74a32e9b169864508101f886fe.tar.bz2
u-boot-52af0101be55da74a32e9b169864508101f886fe.zip
Merge branch 'master' into next
Merge in v2022.07-rc5.
Diffstat (limited to 'fs/squashfs')
-rw-r--r--fs/squashfs/sqfs.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/fs/squashfs/sqfs.c b/fs/squashfs/sqfs.c
index 90bf32ca0a..246ec28b31 100644
--- a/fs/squashfs/sqfs.c
+++ b/fs/squashfs/sqfs.c
@@ -975,6 +975,7 @@ int sqfs_readdir(struct fs_dir_stream *fs_dirs, struct fs_dirent **dentp)
int i_number, offset = 0, ret;
struct fs_dirent *dent;
unsigned char *ipos;
+ u16 name_size;
dirs = (struct squashfs_dir_stream *)fs_dirs;
if (!dirs->size) {
@@ -1057,9 +1058,10 @@ int sqfs_readdir(struct fs_dir_stream *fs_dirs, struct fs_dirent **dentp)
return -SQFS_STOP_READDIR;
}
- /* Set entry name */
- strncpy(dent->name, dirs->entry->name, dirs->entry->name_size + 1);
- dent->name[dirs->entry->name_size + 1] = '\0';
+ /* Set entry name (capped at FS_DIRENT_NAME_LEN which is a U-Boot limitation) */
+ name_size = min_t(u16, dirs->entry->name_size + 1, FS_DIRENT_NAME_LEN - 1);
+ strncpy(dent->name, dirs->entry->name, name_size);
+ dent->name[name_size] = '\0';
offset = dirs->entry->name_size + 1 + SQFS_ENTRY_BASE_LENGTH;
dirs->entry_count--;