From 6f59ae342196008ea07b41a3744f60cd0f1304a0 Mon Sep 17 00:00:00 2001 From: shixuantong <1726671442@qq.com> Date: Sat, 7 May 2022 16:09:49 +0800 Subject: [PATCH] fix sz < 0 --- libtar.spec | 5 ++++- ...ler-Ensure-that-sz-is-greater-than-0.patch | 20 +++++++++---------- 2 files changed, 14 insertions(+), 11 deletions(-) diff --git a/libtar.spec b/libtar.spec index e48bc78..ac9c4a3 100644 --- a/libtar.spec +++ b/libtar.spec @@ -1,6 +1,6 @@ Name: libtar Version: 1.2.20 -Release: 21 +Release: 22 Summary: Library for manipulating tar files from within C programs. License: BSD URL: http://repo.or.cz/libtar.git @@ -71,6 +71,9 @@ rm $RPM_BUILD_ROOT%{_libdir}/*.la %{_mandir}/man3/*.3* %changelog +* Sat May 07 2022 shixuantong - 1.2.20-22 +- fix sz < 0 + * Wed Apr 06 2022 shixuantong - 1.2.20-21 - Ensure that sz is greater than 0. diff --git a/openEuler-Ensure-that-sz-is-greater-than-0.patch b/openEuler-Ensure-that-sz-is-greater-than-0.patch index 4042927..b0b285f 100644 --- a/openEuler-Ensure-that-sz-is-greater-than-0.patch +++ b/openEuler-Ensure-that-sz-is-greater-than-0.patch @@ -15,11 +15,11 @@ index 092bc28..80b41ac 100644 if (TH_ISLONGLINK(t)) { sz = th_get_size(t); -+ if (sz <= 0) -+ { -+ errno = EINVAL; -+ return -1; -+ } ++ if ((int)sz <= 0) ++ { ++ errno = EINVAL; ++ return -1; ++ } blocks = (sz / T_BLOCKSIZE) + (sz % T_BLOCKSIZE ? 1 : 0); if (blocks > ((size_t)-1 / T_BLOCKSIZE)) { @@ -27,11 +27,11 @@ index 092bc28..80b41ac 100644 if (TH_ISLONGNAME(t)) { sz = th_get_size(t); -+ if (sz <= 0) -+ { -+ errno = EINVAL; -+ return -1; -+ } ++ if ((int)sz <= 0) ++ { ++ errno = EINVAL; ++ return -1; ++ } blocks = (sz / T_BLOCKSIZE) + (sz % T_BLOCKSIZE ? 1 : 0); if (blocks > ((size_t)-1 / T_BLOCKSIZE)) {