1 Star 0 Fork 15

syyhao/tar

forked from src-openEuler/tar 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
Fix-possible-NULL-dereference-savannah-bug-55369.patch 1.43 KB
一键复制 编辑 原始数据 按行查看 历史
hexiaowen 提交于 2019-09-30 11:18 . Package init
From cb07844454d8cc9fb21f53ace75975f91185a120 Mon Sep 17 00:00:00 2001
From: Sergey Poznyakoff <gray@gnu.org>
Date: Mon, 14 Jan 2019 15:22:09 +0200
Subject: [PATCH] Fix possible NULL dereference (savannah bug #55369)
* src/sparse.c (pax_decode_header): Check return from find_next_block.
---
src/sparse.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/src/sparse.c b/src/sparse.c
index 55c874f..6ec069d 100644
--- a/src/sparse.c
+++ b/src/sparse.c
@@ -1247,6 +1247,8 @@ pax_decode_header (struct tar_sparse_file *file)
set_next_block_after (b); \
file->dumped_size += BLOCKSIZE; \
b = find_next_block (); \
+ if (!b) \
+ FATAL_ERROR ((0, 0, _("Unexpected EOF in archive"))); \
src = b->buffer; \
endp = b->buffer + BLOCKSIZE; \
} \
@@ -1259,6 +1261,8 @@ pax_decode_header (struct tar_sparse_file *file)
set_next_block_after (current_header);
file->dumped_size += BLOCKSIZE;
blk = find_next_block ();
+ if (!blk)
+ FATAL_ERROR ((0, 0, _("Unexpected EOF in archive")));
p = blk->buffer;
COPY_BUF (blk,nbuf,p);
if (!decode_num (&u, nbuf, TYPE_MAXIMUM (size_t)))
--
1.8.3.1
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/shenyangyang01/tar.git
git@gitee.com:shenyangyang01/tar.git
shenyangyang01
tar
tar
master

搜索帮助