URL Hyperlink data may not use the full length of the data field, but could instead be terminated by a null byte character

This commit is contained in:
MarkBaker 2014-08-03 22:02:46 +01:00
parent c2a04ab777
commit 780cb74782
1 changed files with 3 additions and 0 deletions

View File

@ -4562,6 +4562,9 @@ class PHPExcel_Reader_Excel5 extends PHPExcel_Reader_Abstract implements PHPExce
$offset += 4;
// offset: var; size: $us; character array of the URL, no Unicode string header, always 16-bit characters, zero-terminated
$url = self::_encodeUTF16(substr($recordData, $offset, $us - 2), false);
$nullOffset = strpos($url, 0x00);
if ($nullOffset)
$url = substr($url,0,$nullOffset);
$url .= $hasText ? '#' : '';
$offset += $us;
break;