Accept files names longer than 128 bytes in recursive mode of pcregrep
This commit is contained in:
parent
f6403fa93c
commit
2eb3461ad7
43
pcre-8.41-Fix-pcregrep-recursive-file-name-issue.patch
Normal file
43
pcre-8.41-Fix-pcregrep-recursive-file-name-issue.patch
Normal file
@ -0,0 +1,43 @@
|
||||
From 49b9fc5a42ea59ca095413bdd4d11a952df5562d Mon Sep 17 00:00:00 2001
|
||||
From: ph10 <ph10@2f5784b3-3f2a-0410-8824-cb99058d5e15>
|
||||
Date: Fri, 20 Oct 2017 16:57:48 +0000
|
||||
Subject: [PATCH 1/2] Fix pcregrep recursive file name issue.
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
git-svn-id: svn://vcs.exim.org/pcre/code/trunk@1712 2f5784b3-3f2a-0410-8824-cb99058d5e15
|
||||
|
||||
Petr Písař: Ported to 8.41.
|
||||
|
||||
diff --git a/pcregrep.c b/pcregrep.c
|
||||
index 317f745..d4a5fb5 100644
|
||||
--- a/pcregrep.c
|
||||
+++ b/pcregrep.c
|
||||
@@ -2234,7 +2234,7 @@ if (isdirectory(pathname))
|
||||
|
||||
if (dee_action == dee_RECURSE)
|
||||
{
|
||||
- char buffer[1024];
|
||||
+ char buffer[2048];
|
||||
char *nextfile;
|
||||
directory_type *dir = opendirectory(pathname);
|
||||
|
||||
@@ -2249,7 +2249,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 > 2048)
|
||||
+ {
|
||||
+ 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
|
||||
|
@ -0,0 +1,33 @@
|
||||
From bfd4f2b52faba20be338e06ac23cb1061ec4c777 Mon Sep 17 00:00:00 2001
|
||||
From: ph10 <ph10@2f5784b3-3f2a-0410-8824-cb99058d5e15>
|
||||
Date: Sun, 22 Oct 2017 16:19:42 +0000
|
||||
Subject: [PATCH 2/2] Fix possible memory leak introduced in previous bug fix.
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
git-svn-id: svn://vcs.exim.org/pcre/code/trunk@1713 2f5784b3-3f2a-0410-8824-cb99058d5e15
|
||||
Signed-off-by: Petr Písař <ppisar@redhat.com>
|
||||
---
|
||||
pcregrep.c | 5 +++--
|
||||
1 file changed, 3 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/pcregrep.c b/pcregrep.c
|
||||
index d4a5fb5..a81c88d 100644
|
||||
--- a/pcregrep.c
|
||||
+++ b/pcregrep.c
|
||||
@@ -2253,8 +2253,9 @@ if (isdirectory(pathname))
|
||||
if (fnlength > 2048)
|
||||
{
|
||||
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);
|
||||
if (frc > 1) rc = frc;
|
||||
--
|
||||
2.13.6
|
||||
|
14
pcre.spec
14
pcre.spec
@ -2,7 +2,7 @@
|
||||
#%%global rcversion RC1
|
||||
Name: pcre
|
||||
Version: 8.41
|
||||
Release: %{?rcversion:0.}2%{?rcversion:.%rcversion}%{?dist}
|
||||
Release: %{?rcversion:0.}3%{?rcversion:.%rcversion}%{?dist}
|
||||
%global myversion %{version}%{?rcversion:-%rcversion}
|
||||
Summary: Perl-compatible regular expression library
|
||||
## Source package only:
|
||||
@ -35,6 +35,12 @@ Patch0: pcre-8.21-multilib.patch
|
||||
Patch1: pcre-8.32-refused_spelling_terminated.patch
|
||||
# Fix recursion stack estimator, upstream bug #2173
|
||||
Patch2: pcre-8.41-fix_stack_estimator.patch
|
||||
# 1/2 Accept files names longer than 128 bytes in recursive mode of pcregrep,
|
||||
# upstream bug #2177, in upstream after 8.41
|
||||
Patch3: pcre-8.41-Fix-pcregrep-recursive-file-name-issue.patch
|
||||
# 2/2 Accept files names longer than 128 bytes in recursive mode of pcregrep,
|
||||
# upstream bug #2177, in upstream after 8.41
|
||||
Patch4: pcre-8.41-Fix-possible-memory-leak-introduced-in-previous-bug-.patch
|
||||
BuildRequires: readline-devel
|
||||
BuildRequires: autoconf
|
||||
BuildRequires: automake
|
||||
@ -119,6 +125,8 @@ Utilities demonstrating PCRE capabilities like pcregrep or pcretest.
|
||||
%patch0 -p1
|
||||
%patch1 -p1
|
||||
%patch2 -p2
|
||||
%patch3 -p1
|
||||
%patch4 -p1
|
||||
# Because of rpath patch
|
||||
libtoolize --copy --force
|
||||
autoreconf -vif
|
||||
@ -220,6 +228,10 @@ make %{?_smp_mflags} check VERBOSE=yes
|
||||
%{_mandir}/man1/pcretest.*
|
||||
|
||||
%changelog
|
||||
* Thu Nov 02 2017 Petr Pisar <ppisar@redhat.com> - 8.41-3
|
||||
- Accept files names longer than 128 bytes in recursive mode of pcregrep
|
||||
(upstream bug #2177)
|
||||
|
||||
* Mon Oct 09 2017 Petr Pisar <ppisar@redhat.com> - 8.41-2
|
||||
- Fix recursion stack estimator (upstream bug #2173)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user