Bug #1897: quoted_printable_decode doesn't work properly.
| From: | bfranklin at dct dot com | Date: | Tue, 27 Jul 1999 21:50:49 +0000 |
| Subject: | Bug #1897: quoted_printable_decode doesn't work properly. | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-9248@lists.php.net to get a copy of this message | ||
From: bfranklin@dct.com
Operating system: Solaris 2.7
PHP version: 3.0.11
PHP Bug Type: Misbehaving function
Bug description: quoted_printable_decode doesn't work properly.
quoted_printable_decode doesn't properly handle soft line breaks or encoded data that has been
padded with whitespace at the end of a line.
Here is a patch to fix this problem:
--- php-3.0.11/functions/quot_print.c.orig Wed Jun 16 06:34:22 1999
+++ php-3.0.11/functions/quot_print.c Tue Jul 27 16:47:45 1999
@@ -94,11 +94,18 @@
+ _php3_hex2int((int)str[i+2]);
i += 3;
}
- else if ( str[i] == 13 )
+ else if ( str[i] == '=' && str[i+1] == 13 )
{
- i++;
+ i+=2;
}
- else
+ else if ( str[i] == 13 && (str[i-1] == 9 || str[i-1] == 32) )
+ {
+ while ( str[j] == 9 || str[j] == 32 )
+ j--;
+ j++;
+ str[j++] = str[i++];
+ }
+ else
{
str[j++] = str[i++];
}