# HG changeset patch # User Nathan Walp # Date 1066277845 0 # Node ID f946af3b0039b98800a26aa0d15882118a9e0564 # Parent 0d24c94e4fbc78d3286f5c059c323afbfc1af862 [gaim-migrate @ 7859] fix © and ® in gtkimhtml fix a potential segfault on jabber committer: Tailor Script diff -r 0d24c94e4fbc -r f946af3b0039 src/gtkimhtml.c --- a/src/gtkimhtml.c Thu Oct 16 03:58:50 2003 +0000 +++ b/src/gtkimhtml.c Thu Oct 16 04:17:25 2003 +0000 @@ -754,43 +754,45 @@ static gboolean gtk_imhtml_is_amp_escape (const gchar *string, - gchar *replace, + gchar **replace, gint *length) { + static char buf[3]; g_return_val_if_fail (string != NULL, FALSE); g_return_val_if_fail (replace != NULL, FALSE); g_return_val_if_fail (length != NULL, FALSE); if (!g_ascii_strncasecmp (string, "&", 5)) { - *replace = '&'; + *replace = "&"; *length = 5; } else if (!g_ascii_strncasecmp (string, "<", 4)) { - *replace = '<'; + *replace = "<"; *length = 4; } else if (!g_ascii_strncasecmp (string, ">", 4)) { - *replace = '>'; + *replace = ">"; *length = 4; } else if (!g_ascii_strncasecmp (string, " ", 6)) { - *replace = ' '; + *replace = " "; *length = 6; } else if (!g_ascii_strncasecmp (string, "©", 6)) { - *replace = '©'; /* was: '©' */ + *replace = "©"; *length = 6; } else if (!g_ascii_strncasecmp (string, """, 6)) { - *replace = '\"'; + *replace = "\""; *length = 6; } else if (!g_ascii_strncasecmp (string, "®", 5)) { - *replace = '®'; /* was: '®' */ + *replace = "®"; *length = 5; } else if (!g_ascii_strncasecmp (string, "'", 6)) { - *replace = '\''; + *replace = "\'"; *length = 6; } else if (*(string + 1) == '#') { guint pound = 0; if ((sscanf (string, "&#%u;", £) == 1) && pound != 0) { if (*(string + 3 + (gint)log10 (pound)) != ';') return FALSE; - *replace = (gchar)pound; + g_snprintf(buf, sizeof(buf), "%c", (gchar)pound); + *replace = buf; *length = 2; while (isdigit ((gint) string [*length])) (*length)++; if (string [*length] == ';') (*length)++; @@ -898,7 +900,7 @@ gchar *e, *a; gchar *val; gint len; - gchar c; + gchar *c; GString *ret; while (g_ascii_strncasecmp (t, opt, strlen (opt))) { @@ -935,7 +937,7 @@ e = val; while(*e) { if(gtk_imhtml_is_amp_escape(e, &c, &len)) { - ret = g_string_append_c(ret, c); + ret = g_string_append(ret, c); e += len; } else { ret = g_string_append_c(ret, *e); @@ -1037,7 +1039,7 @@ gint tlen, smilelen, wpos=0; gint type; const gchar *c; - gchar amp; + gchar *amp; guint bold = 0, italics = 0, @@ -1347,7 +1349,9 @@ if(tag) g_free(tag); /* This was allocated back in VALID_TAG() */ } else if (*c == '&' && gtk_imhtml_is_amp_escape (c, &, &tlen)) { - ws [wpos++] = amp; + while(*amp) { + ws [wpos++] = *amp++; + } c += tlen; pos += tlen; } else if (*c == '\n') { diff -r 0d24c94e4fbc -r f946af3b0039 src/protocols/jabber/presence.c --- a/src/protocols/jabber/presence.c Thu Oct 16 03:58:50 2003 +0000 +++ b/src/protocols/jabber/presence.c Thu Oct 16 04:17:25 2003 +0000 @@ -154,6 +154,9 @@ jb = jabber_buddy_find(js, from, TRUE); + if(!jb) + return; + if(jb->error_msg) { g_free(jb->error_msg); jb->error_msg = NULL;