Fixed bad memory access in utf8ToUnicode class

This commit is contained in:
Felipe Zimmerle 2017-01-06 00:56:52 -03:00 committed by Felipe Zimmerle
parent fd341145d5
commit 068a3eb517
No known key found for this signature in database
GPG Key ID: E6DFB08CE8B11277

View File

@ -92,9 +92,12 @@ char *Utf8ToUnicode::inplace(unsigned char *input,
/* single byte unicode (7 bit ASCII equivilent) has no validation */
count++;
if (count <= len) {
if (c == 0)
*data = utils::string::x2c(&c);
else
if (c == 0 && input_len > i + 1) {
unsigned char z[2];
z[0] = *utf;
z[1] = *(utf + 1);
*data = utils::string::x2c((unsigned char*) &z);
} else
*data++ = c;
}
} else if ((c & 0xE0) == 0xC0) {