# HG changeset patch # User Mark Doliner # Date 1057546753 0 # Node ID a170c50b2a48aa349711ecac22f3a1abbd5f91d5 # Parent 72403c3c84e1b3777578c28df7c3330230e4fadc [gaim-migrate @ 6501] This should fix a somewhat rare ICQ crash. http://sourceforge.net/tracker/index.php?func=detail&aid=749156&group_id=235&atid=100235 committer: Tailor Script diff -r 72403c3c84e1 -r a170c50b2a48 src/protocols/oscar/oscar.c --- a/src/protocols/oscar/oscar.c Sun Jul 06 23:33:24 2003 +0000 +++ b/src/protocols/oscar/oscar.c Mon Jul 07 02:59:13 2003 +0000 @@ -2535,7 +2535,7 @@ GaimConnection *gc = sess->aux_data; gchar **msg1, **msg2; GError *err = NULL; - int i; + int i, numtoks; if (!args->type || !args->msg || !args->uin) return 1; @@ -2545,7 +2545,8 @@ /* Split up the message at the delimeter character, then convert each string to UTF-8 */ msg1 = g_strsplit(args->msg, "\376", 0); - msg2 = (gchar **)g_malloc(10*sizeof(gchar *)); /* XXX - 10 is a guess */ + for (numtoks=0; msg1[numtoks]; numtoks++); + msg2 = (gchar **)g_malloc((numtoks+1)*sizeof(gchar *)); for (i=0; msg1[i]; i++) { strip_linefeed(msg1[i]); msg2[i] = g_convert(msg1[i], strlen(msg1[i]), "UTF-8", "ISO-8859-1", NULL, NULL, &err);