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
diff --git a/encoding.c b/encoding.c
index df8714b..8e2397a 100644
--- a/encoding.c
+++ b/encoding.c
@@ -577,9 +577,13 @@
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++;
}