From ac6b8d8224de140f5a6f2ca66e6ce279604a37e6 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Sat, 6 Apr 2024 15:15:04 -0700 Subject: [PATCH] =?UTF-8?q?dd:=20don=E2=80=99t=20trust=20st=5Fsize=20on=20?= =?UTF-8?q?/proc/files?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * src/dd.c (skip): Don’t trust st_size == 0. --- src/dd.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/dd.c b/src/dd.c index 370a42c97..6e0d725da 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