aboutsummaryrefslogtreecommitdiffstats
path: root/encoding.c
diff options
context:
space:
mode:
authorDaniel Veillard <veillard@src.gnome.org>2002-03-21 13:27:59 +0000
committerDaniel Veillard <veillard@src.gnome.org>2002-03-21 13:27:59 +0000
commitdb5529150b89269569b636235ef5371ea08358d6 (patch)
treee6bb1b990070524103fcc1ace9a4b0709ed496e2 /encoding.c
parent9e537937a69591d89a56c1b251a3cd7b85610106 (diff)
downloadandroid_external_libxml2-db5529150b89269569b636235ef5371ea08358d6.tar.gz
android_external_libxml2-db5529150b89269569b636235ef5371ea08358d6.tar.bz2
android_external_libxml2-db5529150b89269569b636235ef5371ea08358d6.zip
fixed a bug in the ISO-Latin 1 to UTF8 encoder raised by Morus Walter
* encoding.c: fixed a bug in the ISO-Latin 1 to UTF8 encoder raised by Morus Walter Daniel
Diffstat (limited to 'encoding.c')
-rw-r--r--encoding.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/encoding.c b/encoding.c
index df8714be..8e2397a2 100644
--- a/encoding.c
+++ b/encoding.c
@@ -577,9 +577,13 @@ isolat1ToUTF8(unsigned char* out, int *outlen,
processed++;
continue;
} else {
- *out++= ((c >> 6) & 0x1F) | 0xC0;
- if (out >= outend)
+ /*
+ * make sure there is 2 chars left in advance
+ */
+ if (out + 1 >= outend) {
break;
+ }
+ *out++= ((c >> 6) & 0x1F) | 0xC0;
*out++= (c & 0x3F) | 0x80;
processed++;
}