plugins/spellchk.c

changeset 12842
ce82d6cbd24f
parent 12711
2d8f2c9b761d
child 12858
ca29b20e8a0e
--- a/plugins/spellchk.c	Thu Jan 12 01:54:59 2006 +0000
+++ b/plugins/spellchk.c	Thu Jan 12 02:19:37 2006 +0000
@@ -125,9 +125,12 @@
 {
 	char buf[7];
 	gchar *lower = g_utf8_strdown(word, -1);
+	gint bytes;
 	gchar *ret;
 
-	g_unichar_to_utf8(g_unichar_toupper(g_utf8_get_char(word)), buf);
+	bytes = g_unichar_to_utf8(g_unichar_toupper(g_utf8_get_char(word)), buf);
+	buf[MIN(bytes, sizeof(buf) - 1)] = '\0';
+
 	ret = g_strconcat(buf, g_utf8_offset_to_pointer(lower, 1), NULL);
 	g_free(lower);
 

mercurial