summaryrefslogtreecommitdiff
path: root/program/lib
diff options
context:
space:
mode:
authorAleksander Machniak <alec@alec.pl>2013-02-18 15:35:02 +0100
committerAleksander Machniak <alec@alec.pl>2013-02-18 15:36:07 +0100
commit203251838b1917bd79c3482b0381ac50f22b3877 (patch)
treebe9043d9fcaf8eee5e1ab245219f4ee6e78c8397 /program/lib
parent60dabb35aed6689dd6b50cb885b3dbbf5504ef1f (diff)
Fix NUL characters in content-type of ms-tnef attachment (#1488964)
Diffstat (limited to 'program/lib')
-rw-r--r--program/lib/tnef_decoder.php11
1 files changed, 6 insertions, 5 deletions
diff --git a/program/lib/tnef_decoder.php b/program/lib/tnef_decoder.php
index 28d368989..e6ccc23d7 100644
--- a/program/lib/tnef_decoder.php
+++ b/program/lib/tnef_decoder.php
@@ -243,16 +243,16 @@ class tnef_decoder
/* Store any interesting attributes. */
switch ($attr_name) {
case self::MAPI_ATTACH_LONG_FILENAME:
+ $value = str_replace("\0", '', $value);
/* Used in preference to AFILENAME value. */
$attachment_data[0]['name'] = preg_replace('/.*[\/](.*)$/', '\1', $value);
- $attachment_data[0]['name'] = str_replace("\0", '', $attachment_data[0]['name']);
break;
case self::MAPI_ATTACH_MIME_TAG:
+ $value = str_replace("\0", '', $value);
/* Is this ever set, and what is format? */
- $attachment_data[0]['type'] = preg_replace('/^(.*)\/.*/', '\1', $value);
+ $attachment_data[0]['type'] = preg_replace('/^(.*)\/.*/', '\1', $value);
$attachment_data[0]['subtype'] = preg_replace('/.*\/(.*)$/', '\1', $value);
- $attachment_data[0]['subtype'] = str_replace("\0", '', $attachment_data[0]['subtype']);
break;
}
}
@@ -295,9 +295,10 @@ class tnef_decoder
break;
case self::AFILENAME:
+ $value = $this->_getx($data, $this->_geti($data, 32));
+ $value = str_replace("\0", '', $value);
/* Strip path. */
- $attachment_data[0]['name'] = preg_replace('/.*[\/](.*)$/', '\1', $this->_getx($data, $this->_geti($data, 32)));
- $attachment_data[0]['name'] = str_replace("\0", '', $attachment_data[0]['name']);
+ $attachment_data[0]['name'] = preg_replace('/.*[\/](.*)$/', '\1', $value);
/* Checksum */
$this->_geti($data, 16);