From 0350142371e0e5ef1e52aa57579f825f919690ec Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petr=20P=C3=ADsa=C5=99?= Date: Wed, 5 Aug 2020 13:41:10 +0200 Subject: [PATCH] Fix a buffer size for asctime_r() and ctime_r() functions --- ...sizes-for-asctime_r-ctime_r-are-smal.patch | 58 +++++++++++++++++++ perl.spec | 7 +++ 2 files changed, 65 insertions(+) create mode 100644 perl-5.33.0-reentr.c-Buffer-sizes-for-asctime_r-ctime_r-are-smal.patch diff --git a/perl-5.33.0-reentr.c-Buffer-sizes-for-asctime_r-ctime_r-are-smal.patch b/perl-5.33.0-reentr.c-Buffer-sizes-for-asctime_r-ctime_r-are-smal.patch new file mode 100644 index 0000000..7778210 --- /dev/null +++ b/perl-5.33.0-reentr.c-Buffer-sizes-for-asctime_r-ctime_r-are-smal.patch @@ -0,0 +1,58 @@ +From 81169c06a76f62ff987ed990ac910c2ae08b3f91 Mon Sep 17 00:00:00 2001 +From: Karl Williamson +Date: Tue, 10 Mar 2020 15:19:57 -0600 +Subject: [PATCH] reentr.c: Buffer sizes for asctime_r,ctime_r are small +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +The needed sizes of these are stated in the man pages, and are much +smaller than were being allocated. + +Signed-off-by: Petr Písař +--- + reentr.c | 4 ++-- + regen/reentr.pl | 5 ++++- + 2 files changed, 6 insertions(+), 3 deletions(-) + +diff --git a/reentr.c b/reentr.c +index 8ddda7bfc0..8438c8f90f 100644 +--- a/reentr.c ++++ b/reentr.c +@@ -52,14 +52,14 @@ Perl_reentrant_size(pTHX) { + # define REENTRANTUSUALSIZE 4096 /* Make something up. */ + + # ifdef HAS_ASCTIME_R +- PL_reentrant_buffer->_asctime_size = REENTRANTSMALLSIZE; ++ PL_reentrant_buffer->_asctime_size = 26; + # endif /* HAS_ASCTIME_R */ + + # ifdef HAS_CRYPT_R + # endif /* HAS_CRYPT_R */ + + # ifdef HAS_CTIME_R +- PL_reentrant_buffer->_ctime_size = REENTRANTSMALLSIZE; ++ PL_reentrant_buffer->_ctime_size = 26; + # endif /* HAS_CTIME_R */ + + # ifdef HAS_GETGRNAM_R +diff --git a/regen/reentr.pl b/regen/reentr.pl +index f5788c7ad9..94721e9dec 100644 +--- a/regen/reentr.pl ++++ b/regen/reentr.pl +@@ -495,8 +495,11 @@ for my $func (@seenf) { + char* _${func}_buffer; + size_t _${func}_size; + EOF ++ my $size = ($func =~ /^(asctime|ctime)$/) ++ ? 26 ++ : "REENTRANTSMALLSIZE"; + push @size, <_${func}_size = REENTRANTSMALLSIZE; ++ PL_reentrant_buffer->_${func}_size = $size; + EOF + pushinitfree $func; + pushssif $endif; +-- +2.25.4 + diff --git a/perl.spec b/perl.spec index a4a9ffd..8e455d5 100644 --- a/perl.spec +++ b/perl.spec @@ -193,6 +193,10 @@ Patch22: perl-5.33.0-After-running-an-action-in-the-debugger-turn-it-off. Patch23: perl-5.33.0-Clearing-DB-action-at-the-end-is-no-longer-needed.patch Patch24: perl-5.33.0-Add-missing-MANIFEST-entry-from-fix-for-debugger.patch +# Fix a buffer size for asctime_r() and ctime_r() functions, +# in upstream after 5.33.0 +Patch25: perl-5.33.0-reentr.c-Buffer-sizes-for-asctime_r-ctime_r-are-smal.patch + # Link XS modules to libperl.so with EU::CBuilder on Linux, bug #960048 Patch200: perl-5.16.3-Link-XS-modules-to-libperl.so-with-EU-CBuilder-on-Li.patch @@ -4203,6 +4207,7 @@ you're not running VMS, this module does nothing. %patch22 -p1 %patch23 -p1 %patch24 -p1 +%patch25 -p1 %patch200 -p1 %patch201 -p1 @@ -4234,6 +4239,7 @@ perl -x patchlevel.h \ 'Fedora Patch22: Fix running actions after stepping in a debugger (GH#17901)' \ 'Fedora Patch23: Fix running actions after stepping in a debugger (GH#17901)' \ 'Fedora Patch24: Fix running actions after stepping in a debugger (GH#17901)' \ + 'Fedora Patch25: Fix a buffer size for asctime_r() and ctime_r() functions' \ 'Fedora Patch200: Link XS modules to libperl.so with EU::CBuilder on Linux' \ 'Fedora Patch201: Link XS modules to libperl.so with EU::MM on Linux' \ %{nil} @@ -6960,6 +6966,7 @@ popd - Fix a link to Unicode Technical Standard #18 (GH#17881) - Fix setting a non-blocking mode in IO::Socket::UNIX (GH#17787) - Fix running actions after stepping in a debugger (GH#17901) +- Fix a buffer size for asctime_r() and ctime_r() functions * Tue Jul 28 2020 Fedora Release Engineering - 4:5.32.0-458 - Rebuilt for https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild