#15630 [Com]: imap_utf7_decode appears to be broken
| From: | gamid at isayev dot net | Date: | Tue, 06 Aug 2002 23:02:28 +0000 |
| Subject: | #15630 [Com]: imap_utf7_decode appears to be broken | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-16101@lists.php.net to get a copy of this message | ||
ID: 15630
Comment by: gamid@isayev.net
Reported By: robert.marchand@umontreal.ca
Status: Feedback
Bug Type: IMAP related
Operating System: SGI Irix 6.5
PHP Version: 4.2.2
New Comment:
JFYI:
cvs -d :pserver:cvsread@cvs.php.net:/repository co php4
cd php4/ext/imap/
cvs update -r 1.112.2.1 php_imap.c
patch php_imap.c _file_with_my_patch_
cvs update -A php_imap.c
cvs ci php_imap.c
As result:
--- php_imap.c 5 Aug 2002 21:53:09 -0000 1.134
+++ php_imap.c 6 Aug 2002 23:00:31 -0000
@@ -2077,14 +2077,14 @@
php_error(E_WARNING, "%s(): Invalid
modified UTF-7 character: `%c'", get_active_function_name(TSRMLS_C),
*inp);
RETURN_FALSE;
} else if (*inp != '&') {
- outlen++;
+ outlen += 2;
} else if (inp + 1 == endp) {
php_error(E_WARNING, "%s(): Unexpected
end of string", get_active_function_name(TSRMLS_C));
RETURN_FALSE;
} else if (inp[1] != '-') {
state = ST_DECODE0;
} else {
- outlen++;
+ outlen += 2;
inp++;
}
} else if (*inp == '-') {
@@ -2134,8 +2134,11 @@
if (*inp == '&' && inp[1] != '-') {
state = ST_DECODE0;
}
- else if ((*outp++ = *inp) == '&') {
- inp++;
+ else {
+ *outp++ = 0x00;
+ if ((*outp++ = *inp) == '&') {
+ inp++;
+ }
}
}
else if (*inp == '-') {
Previous Comments:
------------------------------------------------------------------------
[2002-08-06 18:40:43] kalowsky@php.net
Please update your patch to the current CVS as I can't seem to find the
make it work against my cvs.
------------------------------------------------------------------------
[2002-08-06 17:41:21] gamid@isayev.net
According CVS only warning messages was changed in the function
imap_utf7_decode().
See diff between 1.134 (latest version of /ext/imap/php_imap.c in the
CVS) and 1.112.2.1 (version included into PHP 4.2.2).
Gamid Isayev
------------------------------------------------------------------------
[2002-08-06 17:11:51] kalowsky@php.net
can you please try a recent snapshot from snaps.php.net? It looks like
this has already been fixed in CVS.
------------------------------------------------------------------------
[2002-08-02 11:14:31] kalowsky@php.net
two reports on this, moving it from Bogus status to Open. Updating
version to 4.2.2 as well
Does anyone have access to an IMAP server using utf7 encoding that they
can test this out on?
------------------------------------------------------------------------
[2002-07-29 15:51:05] gamid@isayev.net
This is the updated patch for 'ext/imap/php_imap.c':
--- php_imap.c Mon Jul 29 15:17:45 2002
+++ php_imap.c Mon Jul 29 15:18:27 2002
@@ -2215,14 +2215,14 @@
php_error(E_WARNING, "imap_utf7_decode:
Invalid modified UTF-7 character: `%c'", *inp);
RETURN_FALSE;
} else if (*inp != '&') {
- outlen++;
+ outlen += 2;
} else if (inp + 1 == endp) {
php_error(E_WARNING, "imap_utf7_decode:
Unexpected end of string");
RETURN_FALSE;
} else if (inp[1] != '-') {
state = ST_DECODE0;
} else {
- outlen++;
+ outlen += 2;
inp++;
}
} else if (*inp == '-') {
@@ -2272,8 +2272,11 @@
if (*inp == '&' && inp[1] != '-') {
state = ST_DECODE0;
}
- else if ((*outp++ = *inp) == '&') {
- inp++;
+ else {
+ *outp++ = 0x00;
+ if ((*outp++ = *inp) == '&') {
+ inp++;
+ }
}
}
else if (*inp == '-') {
------------------------------------------------------------------------
The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
http://bugs.php.net/15630
--
Edit this bug report at http://bugs.php.net/?id=15630&edit=1