From 7a5ec3e65d73458472d7c4103bbeb76cf288d852 Mon Sep 17 00:00:00 2001 From: eabdullin Date: Thu, 21 Sep 2023 19:06:43 +0000 Subject: [PATCH] import CS libedit-3.1-38.20210216cvs.el9 --- SOURCES/libedit-editrc.patch | 40 ++++++++++++++++++++++++++++++++++++ SPECS/libedit.spec | 10 +++++++-- 2 files changed, 48 insertions(+), 2 deletions(-) create mode 100644 SOURCES/libedit-editrc.patch diff --git a/SOURCES/libedit-editrc.patch b/SOURCES/libedit-editrc.patch new file mode 100644 index 0000000..145c474 --- /dev/null +++ b/SOURCES/libedit-editrc.patch @@ -0,0 +1,40 @@ +diff -ur libedit-20210419-3.1/src/el.c libedit-20210522-3.1/src/el.c +--- libedit-20210419-3.1/src/el.c 2019-10-25 22:12:05.000000000 +0200 ++++ libedit-20210522-3.1/src/el.c 2021-05-22 20:55:00.000000000 +0200 +@@ -548,15 +548,15 @@ + + fp = NULL; + if (fname == NULL) { +-#ifdef HAVE_ISSETUGID +- if (issetugid()) +- return -1; + +- if ((fname = getenv("EDITRC")) == NULL) { ++ /* secure_getenv is guaranteed to be defined and do the right thing here */ ++ /* because of the defines above which take into account issetugid, */ ++ /* secure_getenv and __secure_getenv availability. */ ++ if ((fname = secure_getenv("EDITRC")) == NULL) { + static const char elpath[] = "/.editrc"; + size_t plen = sizeof(elpath); + +- if ((ptr = getenv("HOME")) == NULL) ++ if ((ptr = secure_getenv("HOME")) == NULL) + return -1; + plen += strlen(ptr); + if ((path = el_calloc(plen, sizeof(*path))) == NULL) +@@ -565,14 +565,7 @@ + elpath + (*ptr == '\0')); + fname = path; + } +-#else +- /* +- * If issetugid() is missing, always return an error, in order +- * to keep from inadvertently opening up the user to a security +- * hole. +- */ +- return -1; +-#endif ++ + } + if (fname[0] == '\0') + return -1; diff --git a/SPECS/libedit.spec b/SPECS/libedit.spec index 9ae769a..aa0dc9e 100644 --- a/SPECS/libedit.spec +++ b/SPECS/libedit.spec @@ -4,7 +4,7 @@ Summary: The NetBSD Editline library Name: libedit Version: 3.1 -Release: 37.%{snap}cvs%{?dist} +Release: 38.%{snap}cvs%{?dist} License: BSD URL: https://www.thrysoee.dk/editline/ Source0: https://www.thrysoee.dk/editline/%{name}-%{snap}-%{version}.tar.gz @@ -13,6 +13,9 @@ BuildRequires: groff-base BuildRequires: make BuildRequires: ncurses-devel +# Fix reading of $HOME/.editrc and $EDITRC +Patch1: libedit-editrc.patch + %description Libedit is an autotool- and libtoolized port of the NetBSD Editline library. It provides generic line editing, history, and tokenization functions, similar @@ -28,7 +31,7 @@ Requires: ncurses-devel%{?_isa} This package contains development files for %{name}. %prep -%autosetup -n %{name}-%{dir_snap}-%{version} +%autosetup -n %{name}-%{dir_snap}-%{version} -p1 # Fix unused direct shared library dependencies. sed -i "s/lncurses/ltinfo/" configure @@ -64,6 +67,9 @@ rm -f $RPM_BUILD_ROOT%{_mandir}/man3/history.3* %{_includedir}/editline/readline.h %changelog +* Wed Jul 19 2023 Miroslav Lichvar 3.1-38.20210216cvs +- Fix reading of $HOME/.editrc and $EDITRC (#2211207) + * Mon Aug 09 2021 Mohan Boddu - 3.1-37.20210216cvs - Rebuilt for IMA sigs, glibc 2.34, aarch64 flags Related: rhbz#1991688