Fix heredoc file descriptor leak

Resolves: #1413676
This commit is contained in:
Siteshwar Vashisht 2017-04-26 13:51:24 +02:00
parent c0a66dfe53
commit fbc2878c17
2 changed files with 22 additions and 1 deletions

View File

@ -0,0 +1,13 @@
diff --git a/redir.c b/redir.c
index 25488ea..1858b0b 100644
--- a/redir.c
+++ b/redir.c
@@ -469,6 +469,8 @@ here_document_to_fd (redirectee, ri)
return (fd);
}
+ SET_CLOSE_ON_EXEC (fd);
+
errno = r = 0; /* XXX */
/* write_here_document returns 0 on success, errno on failure. */
if (redirectee->word)

View File

@ -8,7 +8,7 @@
Version: %{baseversion}%{patchleveltag} Version: %{baseversion}%{patchleveltag}
Name: bash Name: bash
Summary: The GNU Bourne Again shell Summary: The GNU Bourne Again shell
Release: 2%{?dist} Release: 3%{?dist}
License: GPLv3+ License: GPLv3+
Url: http://www.gnu.org/software/bash Url: http://www.gnu.org/software/bash
Source0: ftp://ftp.gnu.org/gnu/bash/bash-%{baseversion}.tar.gz Source0: ftp://ftp.gnu.org/gnu/bash/bash-%{baseversion}.tar.gz
@ -78,6 +78,10 @@ Patch126: bash-4.3-memleak-lc_all.patch
# this patch disables it # this patch disables it
Patch127: bash-4.4-no-loadable-builtins.patch Patch127: bash-4.4-no-loadable-builtins.patch
# 1413676 - Bash leaks heredoc fd to child processes
# This should be dropped while rebasing to bash-4.5
Patch128: bash-4.4-heredoc-cloexec.patch
BuildRequires: texinfo bison BuildRequires: texinfo bison
BuildRequires: ncurses-devel BuildRequires: ncurses-devel
BuildRequires: autoconf, gettext BuildRequires: autoconf, gettext
@ -294,6 +298,10 @@ end
%doc doc/*.ps doc/*.0 doc/*.html doc/article.txt %doc doc/*.ps doc/*.0 doc/*.html doc/article.txt
%changelog %changelog
* Wed Apr 26 2017 Siteshwar Vashisht <svashisht@redhat.com> - 4.4.12-3
- Fix heredoc file descriptor leak
Resolves: #1413676
* Tue Apr 18 2017 Siteshwar Vashisht <svashisht@redhat.com> - 4.4.12-2 * Tue Apr 18 2017 Siteshwar Vashisht <svashisht@redhat.com> - 4.4.12-2
- Document 'bashbug' for reporting bugs - Document 'bashbug' for reporting bugs
Resolves: #1255886 Resolves: #1255886