Skip to content

Commit

Permalink
Attempt to ignore a single unknown Wbxml.
Browse files Browse the repository at this point in the history
Attempting to prevent bad clients from preventing further issues.
  • Loading branch information
mrubinsk committed May 16, 2018
1 parent 58101b8 commit 9beb380
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion lib/Horde/ActiveSync/Message/Base.php
Original file line number Diff line number Diff line change
Expand Up @@ -363,10 +363,23 @@ public function decodeStream(Horde_ActiveSync_Wbxml_Decoder &$decoder)
// Found start tag
if (!isset($this->_mapping[$entity[Horde_ActiveSync_Wbxml::EN_TAG]])) {
$this->_logger->err(sprintf(
'Tag %s unexpected in type XML type %s.',
'Tag %s unexpected in type XML type %s. Attempting to ignore unknown tag.',
$entity[Horde_ActiveSync_Wbxml::EN_TAG],
get_class($this))
);
if ($decoder->isEmptyElement($entity)) {
$this->_logger->err('Tag was empty element. Continuing');
continue;
}
$entity = $decoder->getElement();
if ($entity[Horde_ActiveSync_Wbxml::EN_TYPE] == Horde_ActiveSync_Wbxml::EN_TYPE_CONTENT) {
$entity = $entity->getElement();
if ($entity[Horde_ActiveSync_Wbxml::EN_TYPE] == Horde_ActiveSync_Wbxml::EN_TYPE_ENDTAG) {
$this->_logger->err('Found end tag, continuing.');
continue;
}
}
$this->_logger->err('Unable to ignore unknown tag. Giving up.');
throw new Horde_ActiveSync_Exception('Unexpected tag');
} else {
$map = $this->_mapping[$entity[Horde_ActiveSync_Wbxml::EN_TAG]];
Expand Down

0 comments on commit 9beb380

Please sign in to comment.