From 7648d777302595d819e2a34e41bbda157392667b Mon Sep 17 00:00:00 2001 From: deva Date: Thu, 30 Jul 2009 09:47:03 +0000 Subject: Make sure we don't hang in an infinite loop when encountering malformed macro/template files. --- server/src/macroheaderparser.cc | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'server/src/macroheaderparser.cc') diff --git a/server/src/macroheaderparser.cc b/server/src/macroheaderparser.cc index d6ba0bb..def80c3 100644 --- a/server/src/macroheaderparser.cc +++ b/server/src/macroheaderparser.cc @@ -94,11 +94,13 @@ MacroHeaderParser::~MacroHeaderParser() void MacroHeaderParser::startTag(std::string name, std::map< std::string, std::string> attributes) { - // Create macro and enable parsing of queries, maps and widgets + if(m) return; + if(name == "macro") { - assert(!m); // A Macro has already been allocated, cannot create macro! m = new Macro(); m->attributes = attributes; + } else { + throw Exception("Missing root tag 'macro' - found '" + name + "'"); } } -- cgit v1.2.3