]> granicus.if.org Git - icinga2/commitdiff
Detect infinite recursion in user scripts
authorGunnar Beutner <gunnar@beutner.name>
Wed, 23 Sep 2015 07:21:45 +0000 (09:21 +0200)
committerGunnar Beutner <gunnar@beutner.name>
Wed, 23 Sep 2015 07:21:45 +0000 (09:21 +0200)
fixes #10198

lib/base/scriptframe.cpp

index 634167e687d4577a65c5493ca29d6310284276ff..88f5706f17a7d06e2c7ce87086c9fce10d0217ee 100644 (file)
@@ -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);
 }