summaryrefslogtreecommitdiff
path: root/ext
diff options
context:
space:
mode:
authorMoriyoshi Koizumi <moriyoshi@php.net>2005-03-23 23:22:16 (GMT)
committerMoriyoshi Koizumi <moriyoshi@php.net>2005-03-23 23:22:16 (GMT)
commit2cba0ab304ccc5e4ee28ee87b21387936b17617b (patch)
treedd46fa68d85c9dd2ae37a6da9e6bd9646c50a722 /ext
parent3b39b2237f1ab4a5cc291723d3130c11ce4740e8 (diff)
downloadphp-2cba0ab304ccc5e4ee28ee87b21387936b17617b.tar.gz
- Fix bug #32311 (mb_encode_mimeheader() does not properly escape characters.)
Diffstat (limited to 'ext')
-rw-r--r--ext/mbstring/libmbfl/mbfl/mbfilter.c21
1 files changed, 20 insertions, 1 deletions
diff --git a/ext/mbstring/libmbfl/mbfl/mbfilter.c b/ext/mbstring/libmbfl/mbfl/mbfilter.c
index a339910..ee1762e 100644
--- a/ext/mbstring/libmbfl/mbfl/mbfilter.c
+++ b/ext/mbstring/libmbfl/mbfl/mbfilter.c
@@ -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 */