mirror of
https://github.com/coreutils/coreutils.git
synced 2024-11-27 03:44:26 +08:00
dd: don’t trust st_size on /proc/files
* src/dd.c (skip): Don’t trust st_size == 0.
This commit is contained in:
parent
225cb8d747
commit
ac6b8d8224
2
src/dd.c
2
src/dd.c
@ -1809,7 +1809,7 @@ skip (int fdesc, char const *file, intmax_t records, idx_t blocksize,
|
||||
struct stat st;
|
||||
if (ifstat (STDIN_FILENO, &st) != 0)
|
||||
error (EXIT_FAILURE, errno, _("cannot fstat %s"), quoteaf (file));
|
||||
if (usable_st_size (&st) && 0 <= input_offset
|
||||
if (usable_st_size (&st) && 0 < st.st_size && 0 <= input_offset
|
||||
&& st.st_size - input_offset < offset)
|
||||
{
|
||||
/* When skipping past EOF, return the number of _full_ blocks
|
||||
|
Loading…
Reference in New Issue
Block a user