Skip to content

Commit

Permalink
Null stripping needs to be done after we do unicode conversion, since…
Browse files Browse the repository at this point in the history
… it's null bytes is 2 bytes in length
  • Loading branch information
slusarz committed Jan 29, 2015
1 parent ab6e1fd commit b8fb2f4
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions framework/Compress/lib/Horde/Compress/Tnef.php
Original file line number Diff line number Diff line change
Expand Up @@ -407,14 +407,6 @@ protected function _extractMapiAttributes($data)
/* Pad to next 4 byte boundary. */
$datalen = $length + ((4 - ($length % 4)) % 4);

switch ($attr_type) {
case self::MAPI_STRING:
case self::MAPI_UNICODE_STRING:
// Strings are null-terminated.
--$length;
break;
}

/* Read and truncate to length. */
$value = substr($this->_getx($data, $datalen), 0, $length);
}
Expand All @@ -429,6 +421,15 @@ protected function _extractMapiAttributes($data)
);
break;
}

switch ($attr_type) {
case self::MAPI_STRING:
case self::MAPI_UNICODE_STRING:
// Strings are null-terminated.
$value = substr($value, 0, -1);
break;
}

break;
default:
$this->_logger->notice(sprintf(
Expand Down

0 comments on commit b8fb2f4

Please sign in to comment.