diff --git a/common/xmlparser.h b/common/xmlparser.h index c3eb68ca782..0f859ecf14e 100644 --- a/common/xmlparser.h +++ b/common/xmlparser.h @@ -333,16 +333,17 @@ protected: return parserError("Malformed comment syntax."); _char = _stream->readByte(); - bool dash = false; while (_char) { if (_char == '-') { - if (dash && _stream->readByte() == '>') { + if (_stream->readByte() == '-') { + + if (_stream->readByte() != '>') + return parserError("Malformed comment (double-hyphen inside comment body)."); + _char = _stream->readByte(); return true; } - - dash = !dash; } _char = _stream->readByte();