From: Gunnar Beutner Date: Wed, 23 Sep 2015 07:21:45 +0000 (+0200) Subject: Detect infinite recursion in user scripts X-Git-Tag: v2.4.0~297 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=c15c9cce5e96b3e8ff2f078d8b5dcdb1418e32d4;p=icinga2 Detect infinite recursion in user scripts fixes #10198 --- diff --git a/lib/base/scriptframe.cpp b/lib/base/scriptframe.cpp index 634167e68..88f5706f1 100644 --- a/lib/base/scriptframe.cpp +++ b/lib/base/scriptframe.cpp @@ -19,6 +19,7 @@ #include "base/scriptframe.hpp" #include "base/scriptglobal.hpp" +#include "base/exception.hpp" using namespace icinga; @@ -71,5 +72,8 @@ void ScriptFrame::PushFrame(ScriptFrame *frame) m_ScriptFrames.reset(frames); } + if (frames->size() > 500) + BOOST_THROW_EXCEPTION(ScriptError("Recursion level too deep.")); + frames->push(frame); }