diff --git a/pcre2-10.30-Fix-memory-leak-issue-introduced-in-last-bug-fix-in-.patch b/pcre2-10.30-Fix-memory-leak-issue-introduced-in-last-bug-fix-in-.patch new file mode 100644 index 0000000..058b292 --- /dev/null +++ b/pcre2-10.30-Fix-memory-leak-issue-introduced-in-last-bug-fix-in-.patch @@ -0,0 +1,32 @@ +From 12dd78fc2ff2d941e724c7af72fa22daa8528041 Mon Sep 17 00:00:00 2001 +From: ph10 +Date: Sun, 22 Oct 2017 16:17:44 +0000 +Subject: [PATCH 2/2] Fix memory leak issue introduced in last bug fix in + pcre2grep. +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +git-svn-id: svn://vcs.exim.org/pcre2/code/trunk@874 6239d852-aaf2-0410-a92c-79f79f948069 +Signed-off-by: Petr Písař +--- + src/pcre2grep.c | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/src/pcre2grep.c b/src/pcre2grep.c +index d7410b4..d75917c 100644 +--- a/src/pcre2grep.c ++++ b/src/pcre2grep.c +@@ -3051,7 +3051,8 @@ if (isdirectory(pathname)) + if (fnlength > FNBUFSIZ) + { + fprintf(stderr, "pcre2grep: recursive filename is too long\n"); +- return 2; ++ rc = 2; ++ break; + } + sprintf(buffer, "%s%c%s", pathname, FILESEP, nextfile); + frc = grep_or_recurse(buffer, dir_recurse, FALSE); +-- +2.13.6 + diff --git a/pcre2-10.30-Fix-pcre2grep-recursive-file-name-length-issue.patch b/pcre2-10.30-Fix-pcre2grep-recursive-file-name-length-issue.patch new file mode 100644 index 0000000..874938c --- /dev/null +++ b/pcre2-10.30-Fix-pcre2grep-recursive-file-name-length-issue.patch @@ -0,0 +1,52 @@ +From 386fd5ed13bd694a9940365602be6fcefd52d295 Mon Sep 17 00:00:00 2001 +From: ph10 +Date: Fri, 20 Oct 2017 16:51:59 +0000 +Subject: [PATCH 1/2] Fix pcre2grep recursive file name length issue. +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +git-svn-id: svn://vcs.exim.org/pcre2/code/trunk@873 6239d852-aaf2-0410-a92c-79f79f948069 + +Petr Písař: Ported to 10.30. + +diff --git a/src/pcre2grep.c b/src/pcre2grep.c +index bd86998..d7410b4 100644 +--- a/src/pcre2grep.c ++++ b/src/pcre2grep.c +@@ -109,7 +109,7 @@ typedef int BOOL; + #define MAXPATLEN 8192 + #endif + +-#define FNBUFSIZ 1024 ++#define FNBUFSIZ 2048 + #define ERRBUFSIZ 256 + + /* Values for the "filenames" variable, which specifies options for file name +@@ -3032,7 +3032,7 @@ if (isdirectory(pathname)) + + if (dee_action == dee_RECURSE) + { +- char buffer[1024]; ++ char buffer[FNBUFSIZ]; + char *nextfile; + directory_type *dir = opendirectory(pathname); + +@@ -3047,7 +3047,13 @@ if (isdirectory(pathname)) + while ((nextfile = readdirectory(dir)) != NULL) + { + int frc; +- sprintf(buffer, "%.512s%c%.128s", pathname, FILESEP, nextfile); ++ int fnlength = strlen(pathname) + strlen(nextfile) + 2; ++ if (fnlength > FNBUFSIZ) ++ { ++ fprintf(stderr, "pcre2grep: recursive filename is too long\n"); ++ return 2; ++ } ++ sprintf(buffer, "%s%c%s", pathname, FILESEP, nextfile); + frc = grep_or_recurse(buffer, dir_recurse, FALSE); + if (frc > 1) rc = frc; + else if (frc == 0 && rc == 1) rc = 0; +-- +2.13.6 + diff --git a/pcre2.spec b/pcre2.spec index a31326a..155b840 100644 --- a/pcre2.spec +++ b/pcre2.spec @@ -6,7 +6,7 @@ #%%global rcversion RC1 Name: pcre2 Version: 10.30 -Release: %{?rcversion:0.}1%{?rcversion:.%rcversion}%{?dist} +Release: %{?rcversion:0.}2%{?rcversion:.%rcversion}%{?dist} %global myversion %{version}%{?rcversion:-%rcversion} Summary: Perl-compatible regular expression library # the library: BSD with exceptions @@ -42,6 +42,12 @@ URL: http://www.pcre.org/ Source: ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/%{?rcversion:Testing/}%{name}-%{myversion}.tar.bz2 # Do no set RPATH if libdir is not /usr/lib Patch0: pcre2-10.10-Fix-multilib.patch +# 1/2 Accept files names longer than 128 bytes in recursive mode of pcre2grep, +# upstream bug #2177, in upstream after 10.30 +Patch1: pcre2-10.30-Fix-pcre2grep-recursive-file-name-length-issue.patch +# 2/2 Accept files names longer than 128 bytes in recursive mode of pcre2grep, +# upstream bug #2177, in upstream after 10.30 +Patch2: pcre2-10.30-Fix-memory-leak-issue-introduced-in-last-bug-fix-in-.patch BuildRequires: autoconf BuildRequires: automake BuildRequires: coreutils @@ -116,6 +122,8 @@ Utilities demonstrating PCRE2 capabilities like pcre2grep or pcre2test. %prep %setup -q -n %{name}-%{myversion} %patch0 -p1 +%patch1 -p1 +%patch2 -p1 # Because of multilib patch libtoolize --copy --force autoreconf -vif @@ -219,6 +227,10 @@ make %{?_smp_mflags} check VERBOSE=yes %{_mandir}/man1/pcre2test.* %changelog +* Thu Nov 02 2017 Petr Pisar - 10.30-2 +- Accept files names longer than 128 bytes in recursive mode of pcre2grep + (upstream bug #2177) + * Tue Aug 15 2017 Petr Pisar - 10.30-1 - 10.30 bump