php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #35253 Length of the encoded character string violates a RFC.
Submitted: 2005-11-17 06:04 UTC Modified: 2005-11-19 07:45 UTC
Votes:2
Avg. Score:4.5 ± 0.5
Reproduced:1 of 1 (100.0%)
Same Version:1 (100.0%)
Same OS:0 (0.0%)
From: s dot masugata at digicom dot dnp dot co dot jp Assigned: hirokawa (profile)
Status: Closed Package: mbstring related
PHP Version: 5CVS, 4CVS (2005-11-17) (snap) OS: Solaris8
Private report: No CVE-ID: None
 [2005-11-17 06:04 UTC] s dot masugata at digicom dot dnp dot co dot jp
Description:
------------
Length of the encoded character string violates a RFC.
It violates a RFC when encoding a character string using the mb_encode_mimeheader function.

As for the e-mail header, the total of the field identifier, the field value and the line feed character is defined as being less than 76 characters.
It processes mb_encode_mimeheader function only using the field value.
Therefore, the field length at the head violates a RFC.

Reproduce code:
---------------
<?php
  declare( encoding="EUC-JP" );
  $A  = "??????????????????????????????????????????????????".
        "??????????????????????????????????????";

   $encode = mb_encode_mimeheader( $A, "EUC-JP", "B" );
   mail ( "s.masugata@digicom.dnp.co.jp", $encode, "TEST" );
?>


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2005-11-17 09:21 UTC] sniper@php.net
Please try using this CVS snapshot:

  http://snaps.php.net/php5-latest.tar.gz
 
For Windows:
 
  http://snaps.php.net/win32/php5-win32-latest.zip


 [2005-11-17 13:21 UTC] s dot masugata at digicom dot dnp dot co dot jp
Attempted to try in php5-200511170730 but the status doesn't change.
 [2005-11-17 14:17 UTC] tony2001@php.net
Please put the reproduce script somewhere and paste the link here, so it won't get corrupted by the bug system.
 [2005-11-18 09:04 UTC] s dot masugata at digicom dot dnp dot co dot jp
Thank you for reply. :)

Sorry, Mistaking by the sample scripts to have been specified by me of.
it's as the following:
<?php
  declare( encoding="EUC-JP" );


  $A      = "??????????????????????????????????????????????".
            "??????????????????????????????????????????????";

  $encode = mb_encode_mimeheader( $A, "EUC-JP", "B" );

   $Cc = "Cc: ".$encode." <s.masugata@digicom.dnp.co.jp>";
   mail( "s.masugata@digicom.dnp.co.jp", "TEST Subject", "TEST Body", $Cc );

?>

Cc: =?EUC-JP?B?pKKkoqSipKKkoqSipKKkoqSipKKkoqSipKKkoqSipKKkoqSipKKkoqSipKI=?=
 =?EUC-JP?B?pKKkoqSipKKkoqSipKKkoqSipKKkoqSipKKkoqSipKKkoqSipKKkoqSipKI=?=
 =?EUC-JP?B?pKKkog==?= <s.masugata@digicom.dnp.co.jp>

Because it doesn't consider a field identifier "Cc: " about the mb_encode_mimeheader function, the field length at the head exceeds 76 characters.

It found the patch which solves this problem.
http://www.geocities.jp/rui_hirokawa/php/patch/php4_mb_mime_offset.patch.txt

Please committing, I'm happy. :)
rui knows details.
 [2005-11-18 09:13 UTC] sniper@php.net
Rui, this is yours, I presume. :)

 [2005-11-19 07:45 UTC] hirokawa@php.net
This bug has been fixed in CVS.

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: Thu Mar 28 20:01:28 2024 UTC