Static analysis bug fixes

Resolves: RHEL-43279
This commit is contained in:
Jan Rybar 2024-10-15 13:27:35 +02:00
parent a24268bdbc
commit b6467c6305
2 changed files with 34 additions and 1 deletions

View File

@ -4,7 +4,7 @@
Summary: Utilities for monitoring process activities
Name: psacct
Version: 6.6.4
Release: 22%{?dist}
Release: 23%{?dist}
License: GPL-3.0-or-later
URL: http://www.gnu.org/software/acct/
@ -18,6 +18,7 @@ Patch2: psacct-6.6.1-SEGV-when-record-incomplete.patch
Patch3: psacct-6.6.4-lastcomm-manpage-pid-twice.patch
Patch4: psacct-6.6.4-sprintf-buffer-overflow.patch
Patch5: psacct-6.6.4-specfile-tweaks-file-locs.patch
Patch6: sast_bugs.patch
Conflicts: filesystem < 3
Requires: coreutils
@ -124,6 +125,10 @@ touch /var/account/pacct && chmod 0600 /var/account/pacct
%changelog
* Tue Oct 15 2024 Jan Rybar <jrybar@redhat.com> - 6.6.4-23
- fixed bugs discovered by static analysis
- Resolves: RHEL-43279
* Mon Jun 24 2024 Troy Dawson <tdawson@redhat.com> - 6.6.4-22
- Bump release for June 2024 mass rebuild

28
sast_bugs.patch Normal file
View File

@ -0,0 +1,28 @@
diff --git a/sa.c b/sa.c
index e2e654e..a432e5a 100644
--- a/sa.c
+++ b/sa.c
@@ -1042,9 +1042,11 @@ void write_savacct_file(char *filename)
{
printf ("%s (write_savacct_file): probs writing to file `%s'\n",
program_name, s);
+ fclose(fp);
exit(EXIT_FAILURE);
}
}
+ fclose(fp);
if (rename (s, filename) != 0)
{
@@ -1084,9 +1086,11 @@ void write_usracct_file(char *filename)
{
printf ("%s (write_usracct_file): probs writing to file `%s'\n",
program_name, s);
+ fclose(fp);
exit(EXIT_FAILURE);
}
}
+ fclose(fp);
if (rename (s, filename) != 0)
{