12 Star 0 Fork 71

src-openEuler/coreutils

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
backport-dd-don-t-trust-st_size-on-proc-files.patch 1.07 KB
一键复制 编辑 原始数据 按行查看 历史
From ac6b8d8224de140f5a6f2ca66e6ce279604a37e6 Mon Sep 17 00:00:00 2001
From: Paul Eggert <eggert@cs.ucla.edu>
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 b50b841..a582111 100644
--- a/src/dd.c
+++ b/src/dd.c
@@ -1813,7 +1813,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
--
2.27.0
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/src-openeuler/coreutils.git
git@gitee.com:src-openeuler/coreutils.git
src-openeuler
coreutils
coreutils
master

搜索帮助