changeset 1521:ba83e9e2fd9b

[gaim-migrate @ 1531] fix double-escaping of away messages and fix segfault for away messages that only consist of {}\\\"\n committer: Tailor Script <tailor@pidgin.im>
author Eric Warmenhoven <eric@warmenhoven.org>
date Thu, 01 Mar 2001 02:29:54 +0000
parents f9f1e3bc1918
children 31c0850f9340
files src/toc.c src/util.c
diffstat 2 files changed, 5 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/src/toc.c	Thu Mar 01 01:07:13 2001 +0000
+++ b/src/toc.c	Thu Mar 01 02:29:54 2001 +0000
@@ -742,17 +742,16 @@
 static void toc_set_away(struct gaim_connection *g, char *state, char *message)
 {
 	char buf[MSG_LEN];
+	if (g->away)
+		g_free (g->away);
+	g->away = NULL;
 	if (message) {
+		g->away = g_strdup (message);
 		escape_text(message);
 		g_snprintf(buf, MSG_LEN, "toc_set_away \"%s\"", message);
 	} else
 		g_snprintf(buf, MSG_LEN, "toc_set_away \"\"");
 	sflap_send(g, buf, -1, TYPE_DATA);
-	if (g->away)
-		g_free (g->away);
-	g->away = NULL;
-	if (message)
-		g->away = g_strdup (message);
 }
 
 static void toc_set_info(struct gaim_connection *g, char *info)
--- a/src/util.c	Thu Mar 01 01:07:13 2001 +0000
+++ b/src/util.c	Thu Mar 01 02:29:54 2001 +0000
@@ -518,7 +518,7 @@
 		msg[2047] = '\0';
 	}
 
-	woo = malloc(strlen(msg) * 2);
+	woo = malloc(strlen(msg) * 4 + 1);
 	cpy = g_strdup(msg);
 	c = cpy;
 	while (*c) {