From eaa8e444dd1657eb8e6011cf03b0a1322111852d Mon Sep 17 00:00:00 2001 From: brectanus Date: Wed, 16 May 2007 20:09:28 +0000 Subject: [PATCH] Fixed decoding full-width unicode in t:urlDecodeUni for ASCII range 0xFF01-0xFF5E. Probably need more work/testing. (See #122) --- CHANGES | 3 +++ apache2/msc_util.c | 14 ++++++++++++-- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/CHANGES b/CHANGES index 58b2de35..a545c6f5 100644 --- a/CHANGES +++ b/CHANGES @@ -2,10 +2,13 @@ ?? ??? 2007 - 2.2.0-trunk ------------------------- + * Fixed decoding full-width unicode in t:urlDecodeUni. + * Only calculate debugging vars when we are debugging (more to come). * Removed strnlen() calls for non-GNU platforms. + 11 May 2007 - 2.2.0-dev1 ------------------------- diff --git a/apache2/msc_util.c b/apache2/msc_util.c index f9ebb611..acc33e94 100644 --- a/apache2/msc_util.c +++ b/apache2/msc_util.c @@ -561,8 +561,18 @@ int urldecode_uni_nonstrict_inplace_ex(unsigned char *input, long int input_len) if ( (VALID_HEX(input[i + 2]))&&(VALID_HEX(input[i + 3])) &&(VALID_HEX(input[i + 4]))&&(VALID_HEX(input[i + 5])) ) { - /* We make use of the lower byte here, ignoring the higher byte. */ - *d++ = x2c(&input[i + 4]); + /* We first make use of the lower byte here, ignoring the higher byte. */ + *d = x2c(&input[i + 4]); + + /* Full width ASCII (ff01 - ff5e) needs 0x20 added */ + if ( (*d > 0x00) && (*d < 0x5f) + && ((input[i + 2] == 'f') || (input[i + 2] == 'F')) + && ((input[i + 3] == 'f') || (input[i + 3] == 'F'))) + { + *d += 0x20; + } + + d++; count++; i += 6; } else {