aboutsummaryrefslogtreecommitdiffstats
path: root/lib/string_helpers.c
diff options
context:
space:
mode:
authorDavid Disseldorp <[email protected]>2022-05-10 01:29:20 +0000
committerakpm <[email protected]>2022-05-10 01:29:20 +0000
commit3a2699cfbe317f6e1b9c84d2f10ab7debb1c79dc (patch)
tree86fd88d4da577fcdae5c0f33edbf889bcb290477 /lib/string_helpers.c
parentinitramfs: add INITRAMFS_PRESERVE_MTIME Kconfig option (diff)
downloadkernel-3a2699cfbe317f6e1b9c84d2f10ab7debb1c79dc.tar.gz
kernel-3a2699cfbe317f6e1b9c84d2f10ab7debb1c79dc.zip
gen_init_cpio: fix short read file handling
When processing a "file" entry, gen_init_cpio attempts to allocate a buffer large enough to stage the entire contents of the source file. It then attempts to fill the buffer via a single read() call and subsequently writes out the entire buffer length, without checking that read() returned the full length, potentially writing uninitialized buffer memory. Fix this by breaking up file I/O into 64k chunks and only writing the length returned by the prior read() call. Link: https://lkml.kernel.org/r/[email protected] Signed-off-by: David Disseldorp <[email protected]> Reviewed-by: Martin Wilck <[email protected]> Cc: Al Viro <[email protected]> Cc: Christian Brauner <[email protected]> Cc: Matthew Wilcox (Oracle) <[email protected]> Signed-off-by: Andrew Morton <[email protected]>
Diffstat (limited to 'lib/string_helpers.c')
0 files changed, 0 insertions, 0 deletions