rebuilt with perl 5.36.0 [release 2.2.1_beta1-3mamba;Wed Apr 19 2023]

This commit is contained in:
Silvan Calarco 2024-01-05 22:34:05 +01:00
parent f8b12b1b1c
commit cb6c8cdd6b
2 changed files with 85 additions and 6 deletions

View File

@ -0,0 +1,69 @@
From aa2ce32185b4477e659ed7c70d09c440610ef67b Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Petr=20P=C3=ADsa=C5=99?= <ppisar@redhat.com>
Date: Fri, 2 Feb 2018 12:44:15 +0100
Subject: [PATCH] Fix buffer size when formatting current date
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
gcc-8 and glibc-2.26.9000 reports this error:
server/log.c:64:54: error: '%03d' directive output may be truncated writing between 3 and 11 bytes into a region of size between 0 and 49 [-Werror=format-truncation=]
snprintf(current_date, sizeof(current_date), "%s.%03d", buf, (int)(1000 * (time-seconds)));
^~~~
This patch fixes two mistakes in the get_current_date() function:
First strftime() can fail and then buf content is undefined. The patch
makes sure the buf content is properly null-termited.
Second if strftime() uses up the the whole buf array, no space will be
left for appending miliseconds to current_date value in the subsequent
snprintf() call. The patch increases current_data size so that things
will always fit.
In reality, all this should not matter because sane strftime() will
return fixed-lenght string. But for all the cases and for sake of the
compiler check this patch should be applied.
Signed-off-by: Petr Písař <ppisar@redhat.com>
---
server/log.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/server/log.c b/server/log.c
index 2fe7b7c..f696752 100644
--- a/server/log.c
+++ b/server/log.c
@@ -52,15 +52,17 @@ double get_current_time_exact(void)
return (double) now.tv_sec + now.tv_usec / 1e6; // bad bad idea to use float as precision is not down to the seconds then
}
-char current_date[50];
+char current_date[70];
char* get_current_date(void)
{
struct tm * lt;
char buf[50];
double time = get_current_time_exact();
time_t seconds = (time_t)time;
+ size_t length;
lt = localtime(&seconds);
- strftime(buf, sizeof(buf), "%Y-%m-%d %H:%M:%S", lt);
+ length = strftime(buf, sizeof(buf), "%Y-%m-%d %H:%M:%S", lt);
+ buf[length] = '\0';
snprintf(current_date, sizeof(current_date), "%s.%03d", buf, (int)(1000 * (time-seconds)));
return current_date;
}
diff -up frozen-bubble-2.2.1-beta1/server/log.h~ frozen-bubble-2.2.1-beta1/server/log.h
--- frozen-bubble-2.2.1-beta1/server/log.h~ 2010-08-07 15:36:27.000000000 +0200
+++ frozen-bubble-2.2.1-beta1/server/log.h 2018-02-08 14:09:52.472451694 +0100
@@ -23,7 +23,7 @@
time_t get_current_time(void);
double get_current_time_exact(void);
-extern char current_date[50];
+extern char current_date[70];
char* get_current_date(void);
enum output_types { OUTPUT_TYPE_DEBUG, OUTPUT_TYPE_CONNECT, OUTPUT_TYPE_INFO, OUTPUT_TYPE_ERROR };

View File

@ -1,7 +1,7 @@
%define pkgver %(echo %version | tr _ -) %define pkgver %(echo %version | tr _ -)
Name: frozen-bubble Name: frozen-bubble
Version: 2.2.1_beta1 Version: 2.2.1_beta1
Release: 2mamba Release: 3mamba
Summary: Frozen Bubble arcade game Summary: Frozen Bubble arcade game
Group: Graphical Desktop/Applications/Games Group: Graphical Desktop/Applications/Games
Vendor: openmamba Vendor: openmamba
@ -10,33 +10,37 @@ Packager: Silvan Calarco <silvan.calarco@mambasoft.it>
URL: http://www.frozen-bubble.org/ URL: http://www.frozen-bubble.org/
Source0: http://www.frozen-bubble.org/data/frozen-bubble-%{pkgver}.tar.bz2 Source0: http://www.frozen-bubble.org/data/frozen-bubble-%{pkgver}.tar.bz2
Source1: %{name}-desktop Source1: %{name}-desktop
Patch0: frozen-bubble-2.2.1_beta1-glibc-2.37.patch
License: GPL License: GPL
## AUTOBUILDREQ-BEGIN ## AUTOBUILDREQ-BEGIN
BuildRequires: glibc-devel BuildRequires: glibc-devel
BuildRequires: libglib-devel
BuildRequires: libSDL-devel BuildRequires: libSDL-devel
BuildRequires: libSDL_mixer-devel
BuildRequires: libSDL_Pango-devel BuildRequires: libSDL_Pango-devel
BuildRequires: libSDL_mixer-devel
BuildRequires: libglib-devel
BuildRequires: libperl
BuildRequires: perl-Alien-SDL BuildRequires: perl-Alien-SDL
BuildRequires: perl-Compress-Bzip2
BuildRequires: perl-devel
BuildRequires: perl-File-ShareDir BuildRequires: perl-File-ShareDir
BuildRequires: perl-File-Which BuildRequires: perl-File-Which
BuildRequires: perl-SDL BuildRequires: perl-SDL
BuildRequires: perl-devel
## AUTOBUILDREQ-END ## AUTOBUILDREQ-END
BuildRequires: perl >= 2:5.36.0
BuildRequires: perl-Gimp BuildRequires: perl-Gimp
BuildRequires: perl-IPC-System-Simple BuildRequires: perl-IPC-System-Simple
BuildRequires: perl-Locale-Maketext-Lexicon BuildRequires: perl-Locale-Maketext-Lexicon
BuildRequires: perl-SDL >= 2.546 BuildRequires: perl-SDL >= 2.546
Requires: libSDL_Pango Requires: libSDL_Pango
Requires: perl-SDL >= 2.546 Requires: perl-SDL >= 2.546
BuildRoot: %{_tmppath}/%{name}-%{version}-root
%description %description
Colorful 3D rendered penguin animations, 100 levels of 1p game, hours and hours of 2p game, nights and nights of 2p/3p/4p/5p game over LAN or Internet, a level-editor, 3 professional quality digital soundtracks, 15 stereo sound effects, 8 unique graphical transition effects, 8 unique logo eye-candies. Colorful 3D rendered penguin animations, 100 levels of 1p game, hours and hours of 2p game, nights and nights of 2p/3p/4p/5p game over LAN or Internet, a level-editor, 3 professional quality digital soundtracks, 15 stereo sound effects, 8 unique graphical transition effects, 8 unique logo eye-candies.
%prep %prep
%setup -q -n %{name}-%{pkgver} %setup -q -n %{name}-%{pkgver}
%patch0 -p1 -b .glibc-2.37
sed -e 's|-Werror||' -i inc/My/Builder.pm
%build %build
%{__perl} Build.PL installdirs=vendor %{__perl} Build.PL installdirs=vendor
@ -60,6 +64,9 @@ done
install -D -m644 %{SOURCE1} \ install -D -m644 %{SOURCE1} \
%{buildroot}%{_datadir}/applications/%{name}.desktop %{buildroot}%{_datadir}/applications/%{name}.desktop
find %{buildroot} -name *.so -exec chmod u+w {} \;
chmod u+w %{buildroot}%{_bindir}/fb-server
#%find_lang %{name} #%find_lang %{name}
%clean %clean
@ -105,6 +112,9 @@ exit 0
#README #README
%changelog %changelog
* Wed Apr 19 2023 Silvan Calarco <silvan.calarco@mambasoft.it> 2.2.1_beta1-3mamba
- rebuilt with perl 5.36.0
* Sat Nov 26 2016 Silvan Calarco <silvan.calarco@mambasoft.it> 2.2.1_beta1-2mamba * Sat Nov 26 2016 Silvan Calarco <silvan.calarco@mambasoft.it> 2.2.1_beta1-2mamba
- rebuilt with perl 5.24 - rebuilt with perl 5.24