diff options
author | Daniel Veillard <veillard@src.gnome.org> | 2004-02-09 12:42:55 +0000 |
---|---|---|
committer | Daniel Veillard <veillard@src.gnome.org> | 2004-02-09 12:42:55 +0000 |
commit | 182d32a53733b28ffe3caaa0ab53cda9f9b8522c (patch) | |
tree | 9f5b7f8fd90a78efa0f08e6da1ac3da823da06f7 /encoding.c | |
parent | 5bb9ccd56a812b65e94e71477389be7826203649 (diff) | |
download | libxml2-182d32a53733b28ffe3caaa0ab53cda9f9b8522c.tar.gz |
applied a small patch from Alfred Mickautsch to avoid an out of bound
* encoding.c: applied a small patch from Alfred Mickautsch
to avoid an out of bound error in isolat1ToUTF8()
Daniel
Diffstat (limited to 'encoding.c')
-rw-r--r-- | encoding.c | 19 |
1 files changed, 7 insertions, 12 deletions
@@ -235,28 +235,23 @@ isolat1ToUTF8(unsigned char* out, int *outlen, unsigned char* outend = out + *outlen; const unsigned char* inend; const unsigned char* instop; - xmlChar c = *in; inend = in + (*inlen); instop = inend; while (in < inend && out < outend - 1) { - if (c >= 0x80) { - *out++= ((c >> 6) & 0x1F) | 0xC0; - *out++= (c & 0x3F) | 0x80; + if (*in >= 0x80) { + *out++ = (((*in) >> 6) & 0x1F) | 0xC0; + *out++ = ((*in) & 0x3F) | 0x80; ++in; - c = *in; } if (instop - in > outend - out) instop = in + (outend - out); - while (c < 0x80 && in < instop) { - *out++ = c; - ++in; - c = *in; + while (in < instop && *in < 0x80) { + *out++ = *in++; } } - if (in < inend && out < outend && c < 0x80) { - *out++ = c; - ++in; + if (in < inend && out < outend && *in < 0x80) { + *out++ = *in++; } *outlen = out - outstart; *inlen = in - base; |