2.35-0.4: fix agetty

This commit is contained in:
Karel Zak 2019-12-20 15:10:19 +01:00
parent a61dbe7cc6
commit 80deb77249
2 changed files with 63 additions and 1 deletions

View File

@ -0,0 +1,55 @@
From 9418ba6d05feed6061f5343741b1bc56e7bde663 Mon Sep 17 00:00:00 2001
From: Karel Zak <kzak@redhat.com>
Date: Fri, 20 Dec 2019 15:05:33 +0100
Subject: [PATCH] agetty: keep freed issue file pointer zeroized
References: https://bugzilla.redhat.com/show_bug.cgi?id=1784536
Signed-off-by: Karel Zak <kzak@redhat.com>
---
term-utils/agetty.c | 15 +++++++++++----
1 file changed, 11 insertions(+), 4 deletions(-)
diff --git a/term-utils/agetty.c b/term-utils/agetty.c
index 3c20acc98..dfc4921f5 100644
--- a/term-utils/agetty.c
+++ b/term-utils/agetty.c
@@ -1820,8 +1820,12 @@ static int issuefile_read_stream(
if (fstat(fileno(f), &st) || !S_ISREG(st.st_mode))
return 1;
- if (!ie->output)
- ie->output = open_memstream(&ie->mem, &ie->mem_sz);
+ if (!ie->output) {
+ free(ie->mem);
+ ie->mem_sz = 0;
+ ie->mem = NULL;
+ ie->output = open_memstream(&ie->mem, &ie->mem_sz);
+ }
while ((c = getc(f)) != EOF) {
if (c == '\\')
@@ -1965,8 +1969,10 @@ done:
if (netlink_groups != 0)
open_netlink();
#endif
- if (ie->output)
+ if (ie->output) {
fclose(ie->output);
+ ie->output = NULL;
+ }
}
/* This is --show-issue backend, executed by normal user on the current
@@ -1985,7 +1991,8 @@ static void show_issue(struct options *op)
if (ie.mem_sz)
write_all(STDOUT_FILENO, ie.mem, ie.mem_sz);
-
+ if (ie.output)
+ fclose(ie.output);
free(ie.mem);
}
--
2.21.0

View File

@ -2,7 +2,7 @@
Summary: A collection of basic system utilities
Name: util-linux
Version: 2.35
Release: 0.3%{?dist}
Release: 0.4%{?dist}
License: GPLv2 and GPLv2+ and LGPLv2+ and BSD with advertising and Public Domain
URL: http://en.wikipedia.org/wiki/Util-linux
@ -106,6 +106,10 @@ Requires: libfdisk = %{version}-%{release}
# 151635 - makeing /var/log/lastlog
Patch0: 2.28-login-lastlog-create.patch
# 1784536 - Segfaults in agetty during Cloud image testing
Patch1: 0001-agetty-keep-freed-issue-file-pointer-zeroized.patch
%description
The util-linux package contains a large variety of low-level system
utilities that are necessary for a Linux system to function. Among
@ -932,6 +936,9 @@ fi
%{_libdir}/python*/site-packages/libmount/
%changelog
* Fri Dec 20 2019 Karel Zak <kzak@redhat.com> - 2.35-0.4
- fix #1784536 - Segfaults in agetty during Cloud image testing
* Fri Dec 20 2019 Karel Zak <kzak@redhat.com> - 2.35-0.3
- upgrade to the upstream git snapshot (v2.35-rc1-20-g63f8c66af)
- fix #1783066 - Fedora-Rawhide images do not boot