Fix a buffer size for asctime_r() and ctime_r() functions

This commit is contained in:
Petr Písař 2020-08-05 13:41:10 +02:00
parent e47d422d1b
commit 0350142371
2 changed files with 65 additions and 0 deletions

View File

@ -0,0 +1,58 @@
From 81169c06a76f62ff987ed990ac910c2ae08b3f91 Mon Sep 17 00:00:00 2001
From: Karl Williamson <khw@cpan.org>
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ř <ppisar@redhat.com>
---
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, <<EOF;
- PL_reentrant_buffer->_${func}_size = REENTRANTSMALLSIZE;
+ PL_reentrant_buffer->_${func}_size = $size;
EOF
pushinitfree $func;
pushssif $endif;
--
2.25.4

View File

@ -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 <releng@fedoraproject.org> - 4:5.32.0-458
- Rebuilt for https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild