diff src/gtkimhtml.c @ 7287:3a41c3f80228

[gaim-migrate @ 7868] more fun html entity stuff committer: Tailor Script <tailor@pidgin.im>
author Nathan Walp <nwalp@pidgin.im>
date Fri, 17 Oct 2003 05:58:16 +0000
parents 0f7dd6715a90
children c7f0a4397d9e
line wrap: on
line diff
--- a/src/gtkimhtml.c	Thu Oct 16 22:22:18 2003 +0000
+++ b/src/gtkimhtml.c	Fri Oct 17 05:58:16 2003 +0000
@@ -757,7 +757,7 @@
 			  gchar       **replace,
 			  gint        *length)
 {
-	static char buf[6];
+	static char buf[7];
 	g_return_val_if_fail (string != NULL, FALSE);
 	g_return_val_if_fail (replace != NULL, FALSE);
 	g_return_val_if_fail (length != NULL, FALSE);
@@ -789,9 +789,11 @@
 	} else if (*(string + 1) == '#') {
 		guint pound = 0;
 		if ((sscanf (string, "&#%u;", &pound) == 1) && pound != 0) {
+			int buflen;
 			if (*(string + 3 + (gint)log10 (pound)) != ';')
 				return FALSE;
-			g_unichar_to_utf8((gunichar)pound, buf);
+			buflen = g_unichar_to_utf8((gunichar)pound, buf);
+			buf[buflen] = '\0';
 			*replace = buf;
 			*length = 2;
 			while (isdigit ((gint) string [*length])) (*length)++;