From: Paul Eggert Date: Sat, 6 Apr 2024 22:15:04 +0000 (-0700) Subject: dd: don’t trust st_size on /proc/files X-Git-Tag: v9.6~258 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ac6b8d8224de140f5a6f2ca66e6ce279604a37e6;p=thirdparty%2Fcoreutils.git dd: don’t trust st_size on /proc/files * src/dd.c (skip): Don’t trust st_size == 0. --- diff --git a/src/dd.c b/src/dd.c index 370a42c975..6e0d725da5 100644 --- a/src/dd.c +++ b/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