From 34b4caeccf03f4f6ae14e94b35ca1bb6e3cee1ec Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?louiz=E2=80=99?= Date: Wed, 6 Nov 2019 17:21:06 +0100 Subject: [PATCH] Properly set the default values for invalid integer conf options fix #3372 --- src/xmpp/biboumi_adhoc_commands.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/xmpp/biboumi_adhoc_commands.cpp b/src/xmpp/biboumi_adhoc_commands.cpp index f17a016..ef230fe 100644 --- a/src/xmpp/biboumi_adhoc_commands.cpp +++ b/src/xmpp/biboumi_adhoc_commands.cpp @@ -192,7 +192,13 @@ void ConfigureGlobalStep2(XmppComponent& xmpp_component, AdhocSession& session, if (field->get_tag("var") == "max_history_length" && value && !value->get_inner().empty()) - options.col() = atoi(value->get_inner().data()); + { + try { + options.col() = std::stol(value->get_inner().data()); + } catch (const std::logic_error&) { + options.col() = 20; + } + } else if (field->get_tag("var") == "record_history" && value && !value->get_inner().empty()) { @@ -497,7 +503,7 @@ void ConfigureIrcServerStep2(XmppComponent& xmpp_component, AdhocSession& sessio try { options.col() = std::stol(value->get_inner()); } catch (const std::logic_error&) { - options.col() = -1; + options.col() = 10; } Bridge* bridge = biboumi_component.find_user_bridge(session.get_owner_jid()); if (bridge) -- 2.45.2