covscan 2018 fixes

Related: rhbz#1602700
Version: 1.5.3-15
This commit is contained in:
Pavel Raiskup 2018-11-28 16:19:04 +01:00
parent 1421199b13
commit 272aca8d07
4 changed files with 101 additions and 31 deletions

View File

@ -0,0 +1,63 @@
From e22e7ddbc90ab817d5304dc4a5f73ed1e9148c16 Mon Sep 17 00:00:00 2001
From: Pavel Raiskup <praiskup@redhat.com>
Date: Wed, 28 Nov 2018 16:15:31 +0100
Subject: [PATCH] covscan fixes
- two resource leaks (fixed upstream)
- dropped trailing semicolon which generated several errors (fixed
upstream)
---
libdeflt/default.c | 6 +++---
star/hole.c | 1 +
star/xheader.c | 3 +--
3 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/libdeflt/default.c b/libdeflt/default.c
index 950e590..5ee1ef2 100644
--- a/libdeflt/default.c
+++ b/libdeflt/default.c
@@ -45,12 +45,12 @@ EXPORT int
defltopen(name)
const char *name;
{
- if (dfltfile != (FILE *)NULL)
+ if (dfltfile != (FILE *)NULL) {
fclose(dfltfile);
+ dfltfile = NULL;
+ }
if (name == (char *)NULL) {
- fclose(dfltfile);
- dfltfile = NULL;
return (0);
}
diff --git a/star/hole.c b/star/hole.c
index c200ec9..6deb38b 100644
--- a/star/hole.c
+++ b/star/hole.c
@@ -1187,6 +1187,7 @@ put_sparse(fp, info)
* region of at least TBLOCK size.
*/
put_file(fp, info);
+ free(sparse);
return;
} else if (!silent) {
error("Treating '%s' as sparse\n", info->f_name);
diff --git a/star/xheader.c b/star/xheader.c
index a619e28..786b473 100644
--- a/star/xheader.c
+++ b/star/xheader.c
@@ -146,8 +146,7 @@ LOCAL Uchar dtab[] = "0123456789";
(val) = (val) / (unsigned)10; \
} while ((val) > 0)
-#define scopy(to, from) while ((*(to)++ = *(from)++) != '\0') \
- ;
+#define scopy(to, from) while ((*(to)++ = *(from)++) != '\0')
LOCAL char *xbuf; /* Space used to prepare I/O from/to extended headers */
--
2.19.1

View File

@ -150,7 +150,7 @@ index 9dfcef7..464c751 100644
* WARNING: We now are no more able to open a new remote connection
* unless we have been called by root.
diff --git a/star/star.mk b/star/star.mk
index a6f6cff..68d3482 100644
index fdaff9c..7b89f8c 100644
--- a/star/star.mk
+++ b/star/star.mk
@@ -21,6 +21,7 @@ CPPOPTS += -DUSE_XATTR
@ -161,12 +161,11 @@ index a6f6cff..68d3482 100644
CFILES= star.c header.c cpiohdr.c xheader.c xattr.c \
list.c extract.c create.c append.c diff.c restore.c \
remove.c star_unix.c acl_unix.c acltext.c fflags.c \
@@ -35,7 +36,7 @@ CFILES= star.c header.c cpiohdr.c xheader.c xattr.c \
HFILES= star.h starsubs.h dirtime.h xtab.h xutimes.h \
@@ -36,6 +37,7 @@ HFILES= star.h starsubs.h dirtime.h xtab.h xutimes.h \
movearch.h table.h props.h fifo.h diff.h restore.h \
checkerr.h dumpdate.h bitstring.h
-LIBS= -ldeflt -lrmt -lfind -lschily $(LIB_ACL) $(LIB_ATTR) $(LIB_SOCKET) $(LIB_INTL)
+LIBS= -ldeflt -lrmt -lfind -lschily $(LIB_ACL) $(LIB_ATTR) $(LIB_SOCKET) $(LIB_INTL) $(LIB_SELINUX)
checkerr.h dumpdate.h bitstring.h pathname.h
LIBS= -ldeflt -lrmt -lfind -lschily $(LIB_ACL) $(LIB_ATTR) $(LIB_SOCKET) $(LIB_INTL) $(LIB_CAP)
+LIBS= -ldeflt -lrmt -lfind -lschily $(LIB_ACL) $(LIB_ATTR) $(LIB_SOCKET) $(LIB_INTL) $(LIB_CAP) $(LIB_SELINUX)
XMK_FILE= Makefile.man starformatman.mk
###########################################################################

View File

@ -1,8 +1,8 @@
diff --git a/star/star.mk b/star/star.mk
index 68d3482..4961a29 100644
index a6f6cff..fdaff9c 100644
--- a/star/star.mk
+++ b/star/star.mk
@@ -32,11 +32,11 @@ CFILES= star.c header.c cpiohdr.c xheader.c xattr.c \
@@ -31,11 +31,11 @@ CFILES= star.c header.c cpiohdr.c xheader.c xattr.c \
subst.c volhdr.c \
chdir.c match.c defaults.c dumpdate.c \
fifo.c device.c checkerr.c \
@ -11,9 +11,9 @@ index 68d3482..4961a29 100644
HFILES= star.h starsubs.h dirtime.h xtab.h xutimes.h \
movearch.h table.h props.h fifo.h diff.h restore.h \
- checkerr.h dumpdate.h bitstring.h
-LIBS= -ldeflt -lrmt -lfind -lschily $(LIB_ACL) $(LIB_ATTR) $(LIB_SOCKET) $(LIB_INTL) $(LIB_SELINUX)
-LIBS= -ldeflt -lrmt -lfind -lschily $(LIB_ACL) $(LIB_ATTR) $(LIB_SOCKET) $(LIB_INTL)
+ checkerr.h dumpdate.h bitstring.h pathname.h
+LIBS= -ldeflt -lrmt -lfind -lschily $(LIB_ACL) $(LIB_ATTR) $(LIB_SOCKET) $(LIB_INTL) $(LIB_SELINUX) $(LIB_CAP)
+LIBS= -ldeflt -lrmt -lfind -lschily $(LIB_ACL) $(LIB_ATTR) $(LIB_SOCKET) $(LIB_INTL) $(LIB_CAP)
XMK_FILE= Makefile.man starformatman.mk
###########################################################################

View File

@ -7,29 +7,32 @@
Summary: An archiving tool with ACL support
Name: star
Version: 1.5.3
Release: 14%{?dist}
Release: 15%{?dist}
License: CDDL
Group: Applications/Archiving
URL: http://freecode.com/projects/star
Source: http://downloads.sourceforge.net/s-tar/%{name}-%{version}.tar.bz2
# Fix broken star.mk in 1.5.3 (included from all.mk)
Patch1: star-1.5.3-star-mk.patch
# add SELinux support to star(#)
Patch1: star-1.5.3-selinux.patch
Patch2: star-1.5.3-selinux.patch
# do not segfault with data-change-warn option (#255261)
Patch2: star-1.5-changewarnSegv.patch
Patch3: star-1.5-changewarnSegv.patch
# Prevent buffer overflow for filenames with length of 100 characters (#556664)
Patch3: star-1.5.2-bufferoverflow.patch
Patch4: star-1.5.2-bufferoverflow.patch
# Fix some invalid manpage references (#624612)
Patch4: star-1.5.1-manpagereferences.patch
Patch5: star-1.5.1-manpagereferences.patch
# do not crash when xattrs are not set on all files (#861848)
Patch5: star-1.5.1-selinux-segfault.patch
Patch6: star-1.5.1-selinux-segfault.patch
# note that the H=crc format uses Sum32 algorithm, not CRC
Patch6: star-1.5.1-crc.patch
Patch7: star-1.5.1-crc.patch
# Allow rmt to access all files.
# ~> downstream
@ -41,15 +44,15 @@ Patch8: star-1.5.2-rmt-rh-access.patch
# ~> related to #968980
Patch9: star-1.5.2-use-ssh-by-default.patch
# Fix broken star.mk in 1.5.3 (included from all.mk)
Patch10: star-1.5.3-star-mk.patch
# Fix segfault for 'pax -X' (rhbz#1175009)
# ~> downstream
Patch11: star-1.5.3-pax-X-option.patch
Patch10: star-1.5.3-pax-X-option.patch
# Fix segfault on restore default acl (rhbz#1567836)
Patch12: star-1.5.3-default-acl.patch
Patch11: star-1.5.3-default-acl.patch
# Upstream fixed issues detected by covscan
Patch12: star-1.5.3-covscan-2018.patch
BuildRequires: libattr-devel libacl-devel libtool libselinux-devel
BuildRequires: e2fsprogs-devel
@ -101,19 +104,20 @@ restoring files from a backup), and tar (an archiving program).
%prep
%setup -q
%patch1 -p1 -b .bug-config-1.5.3 %{?_rawbuild}
%if %{WITH_SELINUX}
%patch1 -p1 -b .selinux
%patch2 -p1 -b .selinux
%endif
%patch2 -p1 -b .changewarnSegv
%patch3 -p1 -b .namesoverflow
%patch4 -p1 -b .references
%patch5 -p1 -b .selinux-segfault
%patch6 -p1 -b .crc
%patch3 -p1 -b .changewarnSegv
%patch4 -p1 -b .namesoverflow
%patch5 -p1 -b .references
%patch6 -p1 -b .selinux-segfault
%patch7 -p1 -b .crc
%patch8 -p1 -b .rmt-access-rules
%patch9 -p1 -b .ssh-by-default
%patch10 -p1 -b .bug-config-1.5.3
%patch11 -p1 -b .pax-X
%patch12 -p1 -b .default-acl
%patch10 -p1 -b .pax-X
%patch11 -p1 -b .default-acl
%patch12 -p1 -b .covscan-2018
# disable single "fat" binary
cp -a star/all.mk star/Makefile
@ -237,6 +241,10 @@ fi
%{_sysconfdir}/rmt
%changelog
* Wed Nov 28 2018 Pavel Raiskup <praiskup@redhat.com> - 1.5.3-15
- fix covscan issues which have upstream fix (rhbz#1602700)
- reorder patches so we can easily apply %%_rawbuild macro
* Wed Aug 01 2018 Vaclav Danek <vdanek@redhat.com> - 1.5.3-14
- Fix segfault on restore default acl (rhbz#1567836)