Skip to content
Snippets Groups Projects
Commit 96aebafa authored by Jesper Juhl's avatar Jesper Juhl Committed by Michal Marek
Browse files

gen_init_cpio: Avoid race between call to stat() and call to open()


In usr/gen_init_cpio.c::cpio_mkfile() a call to stat() is made based on
pathname, subsequently the file is open()'ed and then the value of the
initial stat() call is used to allocate a buffer. This is not safe since
the file may change between the call to stat() and the call to open().
Safer to just open() the file and then do fstat() using the filedescriptor
returned by open.

Signed-off-by: default avatarJesper Juhl <jj@chaosbits.net>
Acked-by: default avatarJeff Garzik <jgarzik@redhat.com>
Signed-off-by: default avatarMichal Marek <mmarek@suse.cz>
parent 731ece41
No related merge requests found
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment