Skip to content

Commit b600669

Browse files
victorhoraFelipe Zimmerle
authored andcommitted
Fix buffer size for utf8toUnicode transformation
1 parent d8c7112 commit b600669

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

CHANGES

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
DD MMM YYYY - 2.9.3 - To be released
22
------------------------------------
33

4+
* Fix buffer size for utf8toUnicode transformation
5+
[Issue #1208 - @katef, @victorhora]
46
* Fix sanitizing JSON request bodies in native audit log format
57
[p0pr0ck5, @victorhora]
68
* IIS: Update Wix installer to bundle a supported CRS version (3.0)

apache2/msc_util.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -113,8 +113,9 @@ char *utf8_unicode_inplace_ex(apr_pool_t *mp, unsigned char *input, long int inp
113113
unsigned char *unicode = NULL;
114114

115115
*changed = 0;
116-
117-
len = input_len * 7 + 1;
116+
/* RFC3629 states that UTF-8 are encoded using sequences of 1 to 4 octets. */
117+
/* Max size per character should fit in 4 bytes */
118+
len = input_len * 4 + 1;
118119
data = rval = apr_palloc(mp, len);
119120
if (rval == NULL) return NULL;
120121

0 commit comments

Comments
 (0)