]> granicus.if.org Git - php/commitdiff
- MFH: commit the pending patch (bug #32311).
authorMoriyoshi Koizumi <moriyoshi@php.net>
Wed, 13 Apr 2005 08:08:28 +0000 (08:08 +0000)
committerMoriyoshi Koizumi <moriyoshi@php.net>
Wed, 13 Apr 2005 08:08:28 +0000 (08:08 +0000)
NEWS
ext/mbstring/libmbfl/mbfl/mbfilter.c

diff --git a/NEWS b/NEWS
index 2ca7a2f149769b623cdff3659045c14649fc85ab..109373ce2feb4466b47cd53068fcec40287bb3b0 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -15,6 +15,8 @@ PHP 4                                                                      NEWS
   longer then the original string). (Ilia)
 - Fixed bug #32491 (File upload error - unable to create a temporary file).
   (Uwe Schindler)
+- Fixed bug #32311 (mb_encode_mimeheader() does not properly escape characters).
+  (Moriyoshi)
 
 31 Mar 2005, Version 4.3.11
 - Added Oracle Instant Client support. (cjbj at hotmail dot com, Tony)
index a33991058c63abd9160f2acbd3031ff68268efc4..ee1762e38eb8dcd516019f054ffe773dd4dc396c 100644 (file)
@@ -1960,6 +1960,25 @@ mime_header_encoder_block_collector(int c, void *data)
 static int
 mime_header_encoder_collector(int c, void *data)
 {
+       static int qp_table[256] = {
+               1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 0x00 */
+               1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 0x00 */
+               1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0x20 */
+               0, 0, 0, 0, 0, 0, 0 ,0, 0, 0, 0, 0, 0, 1, 0, 1, /* 0x10 */
+               0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0x40 */
+               0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, /* 0x50 */
+               0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0x60 */
+               0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, /* 0x70 */
+               1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 0x80 */
+               1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 0x90 */
+               1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 0xA0 */
+               1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 0xB0 */
+               1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 0xC0 */
+               1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 0xD0 */
+               1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 0xE0 */
+               1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1  /* 0xF0 */
+       };
+
        int n;
        struct mime_header_encoder_data *pe = (struct mime_header_encoder_data *)data;
 
@@ -1969,7 +1988,7 @@ mime_header_encoder_collector(int c, void *data)
                break;
 
        default:        /* ASCII */
-               if (c >= 0x21 && c < 0x7f) {    /* ASCII exclude SPACE and CTLs */
+               if (!qp_table[(c & 0xff)]) { /* ordinary characters */
                        mbfl_memory_device_output(c, &pe->tmpdev);
                        pe->status1 = 1;
                } else if (pe->status1 == 0 && c == 0x20) {     /* repeat SPACE */