#45460 [Csd]: imap patch for fromlength fix in imap_headerinfo doesn't accept lengths of 1024
| From: | andrew at lifescale dot com | Date: | Thu, 10 Jul 2008 18:42:17 +0000 |
| Subject: | #45460 [Csd]: imap patch for fromlength fix in imap_headerinfo doesn't accept lengths of 1024 | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-126445@lists.php.net to get a copy of this message | ||
ID: 45460
User updated by: andrew at lifescale dot com
Reported By: andrew at lifescale dot com
Status: Closed
Bug Type: IMAP related
Operating System: FreeBSD 6.1
PHP Version: 5.2.6
New Comment:
I noticed the buffer size for the from / subject data wasn't
increased.
Does it not need to be:
fulladdress[MAILTMPLEN + 1];
Since a subject of 1024 would fill fulladdress and not have room for a
null byte at the end?
Previous Comments:
------------------------------------------------------------------------
[2008-07-10 17:49:45] felipe@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.
------------------------------------------------------------------------
[2008-07-08 16:16:34] andrew at lifescale dot com
Description:
------------
There was a patch on April 1 for imap.c that added a sanity check to
the from and subject lengths when calling imap_headerinfo()
http://cvs.php.net/viewvc.cgi/php-src/ext/imap/php_imap.c?r1=1.247&r2=1.248
The error message says that the from / subject lengths have to be
between 1 and 1024. However it will not accept a fromlength of 1024 due
to the >= operator. MAILTMPLEN is 1024
This causes a problem for the pear library IMAPv2 as it defaults the
fromlength and subjectlength to 1024
Either the error message must be updated to MAILTMPLEN-1, or the
operator and char array must be changed (this is preferred as to not
bust IMAPv2)
Reproduce code:
---------------
I don't have a good example as I use IMAPv2. However, it seems like a
simple problem just by looking at the code
Expected result:
----------------
imap_headerinfo should accept a fromlength of 1024
Actual result:
--------------
A warning is given:
Jul 8 00:01:49 php: PHP Warning: imap_headerinfo(): From length has
to be between 1 and 1024 in /usr/local/lib/php/Mail/IMAPv2.php on line
1505
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=45460&edit=1