diff options
| author | David Disseldorp <[email protected]> | 2022-05-09 18:29:20 -0700 |
|---|---|---|
| committer | akpm <[email protected]> | 2022-05-09 18:29:20 -0700 |
| commit | 3a2699cfbe317f6e1b9c84d2f10ab7debb1c79dc (patch) | |
| tree | 86fd88d4da577fcdae5c0f33edbf889bcb290477 /scripts/gdb/linux/utils.py | |
| parent | 1274aea127b2e8c9a4b9cbcc3ea6baf78990a958 (diff) | |
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 'scripts/gdb/linux/utils.py')
0 files changed, 0 insertions, 0 deletions