php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #53304 iconv_mime_docode() doesn't handle lowercase hex digits
Submitted: 2010-11-13 10:31 UTC Modified: 2010-11-25 22:38 UTC
From: daniel dot mueller at inexio dot net Assigned: iliaa (profile)
Status: Closed Package: ICONV related
PHP Version: 5.3SVN-2010-11-13 (snap) OS: all
Private report: No CVE-ID: None
 [2010-11-13 10:31 UTC] daniel dot mueller at inexio dot net
Description:
------------
iconv_mime_docode() doesn't handle lowercase hex digits in Q-encoding.

According rfc2047 hex digits should be in uppercase, but it must not be in this way.

Example:
=c3=bc - gives error
=C3=BC - works



Test script:
---------------
<?php
error_reporting(E_ALL);
echo iconv_mime_decode('=?utf-8?Q?Nachricht_=c3=bcber_Kontaktformular_www.inexio.net?=', 0, 'UTF-8') . "\n";
echo iconv_mime_decode('=?utf-8?Q?Nachricht_=C3=BCber_Kontaktformular_www.inexio.net?=', 0, 'UTF-8') . "\n";
?>


Expected result:
----------------
Nachricht über Kontaktformular www.inexio.net
Nachricht über Kontaktformular www.inexio.net

Actual result:
--------------
Notice: iconv_mime_decode(): Unknown error (25) in /usr/home/dm/test.php on line 3

Nachricht über Kontaktformular www.inexio.net


Patches

bugfix-53304 (last revision 2010-11-17 18:18 UTC by daniel dot mueller at inexio dot net)

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2010-11-17 19:36 UTC] daniel dot mueller at inexio dot net
-Operating System: FreeBSD 7.2-RELEASE +Operating System: all
 [2010-11-17 19:36 UTC] daniel dot mueller at inexio dot net
I have attached a fix for this problem.

The patch changes php_quot_print_decode() in ext/standard/quot_print.c so,
that it accepts the lowercase hex digits a-f.

This function seems currently only used for mime header decoding according 
rfc2047 in ext/iconv/iconv.c

However rfc2045 defines lowercase characters as illegal, but allows to recognize 
them as the corresponding uppercase letters in decoding.
 [2010-11-23 13:57 UTC] aharvey@php.net
-Status: Open +Status: Assigned -Assigned To: +Assigned To: aharvey
 [2010-11-25 22:38 UTC] iliaa@php.net
Automatic comment from SVN on behalf of iliaa
Revision: http://svn.php.net/viewvc/?view=revision&amp;revision=305759
Log: Fixed bug #53304 (quot_print_decode does not handle lower-case hex digits)
 [2010-11-25 22:38 UTC] iliaa@php.net
-Status: Assigned +Status: Closed -Assigned To: aharvey +Assigned To: iliaa
 [2010-11-25 22:38 UTC] iliaa@php.net
This bug has been fixed in SVN.

Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
http://snaps.php.net/.
 
Thank you for the report, and for helping us make PHP better.


 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Tue Mar 19 03:01:29 2024 UTC