!7 Execute setlocale before printing

From: @ultra_planet
Reviewed-by: @small_leek
Signed-off-by: @small_leek
This commit is contained in:
openeuler-ci-bot 2021-09-22 07:54:58 +00:00 committed by Gitee
commit 97f0c2d74c
2 changed files with 89 additions and 1 deletions

View File

@ -0,0 +1,84 @@
From c32047a4b4583e745b663a03ca89587a59c2059f Mon Sep 17 00:00:00 2001
From: lingsheng <lingsheng@huawei.com>
Date: Wed, 22 Sep 2021 14:36:39 +0800
Subject: [PATCH] Execute setlocale before printing
---
src/fe-none/irssi.c | 13 +++++++++++++
src/fe-text/irssi.c | 22 +++++++++++-----------
2 files changed, 24 insertions(+), 11 deletions(-)
diff --git a/src/fe-none/irssi.c b/src/fe-none/irssi.c
index 6c60162..3c5e4df 100644
--- a/src/fe-none/irssi.c
+++ b/src/fe-none/irssi.c
@@ -25,6 +25,8 @@
#include "signals.h"
#include "core.h"
+#include <locale.h>
+
#ifdef HAVE_STATIC_PERL
void perl_core_init(void);
void perl_core_deinit(void);
@@ -86,6 +88,17 @@ int main(int argc, char **argv)
{ NULL }
};
+ /* setlocale() must be called at the beginning before any calls that
+ affect it, especially regexps seem to break if they're generated
+ before this call.
+
+ locales aren't actually used for anything else than autodetection
+ of UTF-8 currently..
+
+ furthermore to get the users's charset with g_get_charset() properly
+ you have to call setlocale(LC_ALL, "") */
+ setlocale(LC_ALL, "");
+
autoload_module = NULL;
core_register_options();
args_register(options);
diff --git a/src/fe-text/irssi.c b/src/fe-text/irssi.c
index 0288e4f..58ce661 100644
--- a/src/fe-text/irssi.c
+++ b/src/fe-text/irssi.c
@@ -271,6 +271,17 @@ int main(int argc, char **argv)
};
int loglev;
+ /* setlocale() must be called at the beginning before any calls that
+ affect it, especially regexps seem to break if they're generated
+ before this call.
+
+ locales aren't actually used for anything else than autodetection
+ of UTF-8 currently..
+
+ furthermore to get the users's charset with g_get_charset() properly
+ you have to call setlocale(LC_ALL, "") */
+ setlocale(LC_ALL, "");
+
core_register_options();
fe_common_core_register_options();
args_register(options);
@@ -293,17 +304,6 @@ int main(int argc, char **argv)
SOCKSinit(argv[0]);
#endif
- /* setlocale() must be called at the beginning before any calls that
- affect it, especially regexps seem to break if they're generated
- before this call.
-
- locales aren't actually used for anything else than autodetection
- of UTF-8 currently..
-
- furthermore to get the users's charset with g_get_charset() properly
- you have to call setlocale(LC_ALL, "") */
- setlocale(LC_ALL, "");
-
loglev = g_log_set_always_fatal(G_LOG_FATAL_MASK | G_LOG_LEVEL_CRITICAL);
textui_init();
--
2.23.0

View File

@ -2,7 +2,7 @@
Name: irssi
Version: 1.1.2
Release: 3
Release: 4
Summary: A modular char client.
License: GPLv2+
URL: http://irssi.org/
@ -10,6 +10,7 @@ Source0: https://github.com/irssi/irssi/releases/download/%{version}/irss
Source1: irssi-config.h
Patch0000: CVE-2019-13045-pre.patch
Patch0001: CVE-2019-13045.patch
Patch0002: Execute-setlocale-before-printing.patch
BuildRequires: ncurses-devel openssl-devel zlib-devel autoconf automake libtool
BuildRequires: pkgconfig glib2-devel perl-devel perl-generators perl(ExtUtils::Embed)
@ -62,6 +63,9 @@ chmod -R u+w $RPM_BUILD_ROOT%{perl_vendorarch}
%{_includedir}/irssi/
%changelog
* Wed Sep 22 2021 lingsheng <lingsheng@huawei.com> - 1.1.2-4
- Execute setlocale before printing
* Thu Feb 04 2021 wangyue <wangyue92@huawei.com> - 1.1.2-3
- fix CVE-2019-13045