From bc96a25e4401884fe685d0b1c583908825eb07e8 Mon Sep 17 00:00:00 2001 From: lingsheng Date: Wed, 22 Sep 2021 15:43:19 +0800 Subject: [PATCH] Execute setlocale before printing --- Execute-setlocale-before-printing.patch | 84 +++++++++++++++++++++++++ irssi.spec | 6 +- 2 files changed, 89 insertions(+), 1 deletion(-) create mode 100644 Execute-setlocale-before-printing.patch diff --git a/Execute-setlocale-before-printing.patch b/Execute-setlocale-before-printing.patch new file mode 100644 index 0000000..8e320af --- /dev/null +++ b/Execute-setlocale-before-printing.patch @@ -0,0 +1,84 @@ +From c32047a4b4583e745b663a03ca89587a59c2059f Mon Sep 17 00:00:00 2001 +From: lingsheng +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 ++ + #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 + diff --git a/irssi.spec b/irssi.spec index 586487a..152b9ec 100644 --- a/irssi.spec +++ b/irssi.spec @@ -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 - 1.1.2-4 +- Execute setlocale before printing + * Thu Feb 04 2021 wangyue - 1.1.2-3 - fix CVE-2019-13045