6.0.0-beta1
7/15/25

[#11390] tnef: UTF-16 encoded mime type not recognized
Summary tnef: UTF-16 encoded mime type not recognized
Queue IMP
Queue Version FRAMEWORK_4
Type Bug
State Resolved
Priority 1. Low
Owners slusarz (at) horde (dot) org
Requester andrey012 (at) gmail (dot) com
Created 08/31/2012 (4701 days ago)
Due
Updated 10/15/2012 (4656 days ago)
Assigned
Resolved 09/03/2012 (4698 days ago)
Github Issue Link
Github Pull Request
Milestone
Patch No

History
10/15/2012 08:36:54 PM Git Commit Comment #5 Reply to this comment
Changes have been made in Git (develop):

commit bba44b37974a6aca0a3da13ee2ab15081b0d82cc
Author: Michael M Slusarz <slusarz@horde.org>
Date:   Mon Sep 3 01:24:02 2012 -0600

     [mms] Fix parsing UTF-16 data in TNEF driver (Bug #11390
(andrey012@gmail.com).

  framework/Compress/lib/Horde/Compress/Tnef.php |    1 +
  framework/Compress/package.xml                 |    4 ++--
  2 files changed, 3 insertions(+), 2 deletions(-)

http://git.horde.org/horde-git/-/commit/bba44b37974a6aca0a3da13ee2ab15081b0d82cc
09/03/2012 07:44:42 AM Git Commit Comment #4 Reply to this comment
Changes have been made in Git (master):

commit bba44b37974a6aca0a3da13ee2ab15081b0d82cc
Author: Michael M Slusarz <slusarz@horde.org>
Date:   Mon Sep 3 01:24:02 2012 -0600

     [mms] Fix parsing UTF-16 data in TNEF driver (Bug #11390
(andrey012@gmail.com).

  framework/Compress/lib/Horde/Compress/Tnef.php |    1 +
  framework/Compress/package.xml                 |    4 ++--
  2 files changed, 3 insertions(+), 2 deletions(-)

http://git.horde.org/horde-git/-/commit/bba44b37974a6aca0a3da13ee2ab15081b0d82cc
09/03/2012 07:26:27 AM Michael Slusarz Assigned to Michael Slusarz
State ⇒ Resolved
Version ⇒ FRAMEWORK_4
 
09/03/2012 07:24:22 AM Git Commit Comment #3 Reply to this comment
Changes have been made in Git (FRAMEWORK_4):

commit bef0470c50af03230f46e54e272c276cc0af45a7
Author: Michael M Slusarz <slusarz@horde.org>
Date:   Mon Sep 3 01:24:02 2012 -0600

     [mms] Fix parsing UTF-16 data in TNEF driver (Bug #11390
(andrey012@gmail.com).

  framework/Compress/lib/Horde/Compress/Tnef.php |    1 +
  framework/Compress/package.xml                 |    4 ++--
  2 files changed, 3 insertions(+), 2 deletions(-)

http://git.horde.org/horde-git/-/commit/bef0470c50af03230f46e54e272c276cc0af45a7
08/31/2012 05:27:05 PM andrey012 (at) gmail (dot) com Comment #2
New Attachment: 11390.patch Download
Reply to this comment
Suggested fix:
              case self::MAPI_ATTACH_MIME_TAG:
                  /* Is this ever set, and what is format? */
                  $attachment_data[0]['type'] = 
preg_replace('/^(.*)\/.*/', '\1', $value);
+                $attachment_data[0]['type'] = str_replace("\0", '', 
$attachment_data[0]['type']);
                  $attachment_data[0]['subtype'] = 
preg_replace('/.*\/(.*)$/', '\1', $value);
                  $attachment_data[0]['subtype'] = str_replace("\0", 
'', $attachment_data[0]['subtype']);

08/31/2012 05:20:48 PM andrey012 (at) gmail (dot) com Comment #1
Priority ⇒ 1. Low
Type ⇒ Bug
Summary ⇒ tnef: UTF-16 encoded mime type not recognized
Queue ⇒ IMP
Milestone ⇒
Patch ⇒ No
State ⇒ Unconfirmed
Reply to this comment
when mime-type (and other properties) are UTF-16 encoded -- zeroes in 
type are not stripped correctly.

Here is piece of existing code:
             case self::MAPI_ATTACH_MIME_TAG:
                 /* Is this ever set, and what is format? */
                 $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']);

You can see that zeroes are stripped in subtype but not in type.
AS a result JPEGs appear to be x-unknown/jpeg instead of image/jpeg

Saved Queries