# HG changeset patch # User Mark Doliner # Date 1249434792 0 # Node ID f6dab0e7a817cee156b61919ba8c019473209718 # Parent 0494db6c7f27050a451d2f13dc68349ba7fc3e73 Take care of a special case where we would incorrectly parse incoming IMs if they contained an html tag that had an attribute with an unquoted > We can't use purple_markup_find_tag() for this because that function is only able to look for a specific tag, and we're looking for any tag. But I copied these two loops from that function and it seems to work well. I added some test cases for this, but I've also added some other test cases for another function which fail with the current code. Once everything is passing with flying colors I'll check them in. diff -r 0494db6c7f27 -r f6dab0e7a817 libpurple/protocols/yahoo/util.c --- a/libpurple/protocols/yahoo/util.c Wed Aug 05 00:53:51 2009 +0000 +++ b/libpurple/protocols/yahoo/util.c Wed Aug 05 01:13:12 2009 +0000 @@ -580,11 +580,19 @@ gchar *tag_name; if (x[j] != '>') { + if (x[j] == '"') { + /* We're inside a quoted attribute value. Skip to the end */ + j++; + while (j != x_len && x[j] != '"') + j++; + } else if (x[j] == '\'') { + /* We're inside a quoted attribute value. Skip to the end */ + j++; + while (j != x_len && x[j] != '\'') + j++; + } if (j != x_len) /* Keep looking for the end of this tag */ - /* TODO: Should maybe use purple_markup_find_tag() - * for this... what happens if there is a > inside - * a quoted attribute. */ continue; /* This < has no corresponding > */ @@ -697,7 +705,6 @@ static void _parse_font_tag(const char *src, GString *dest, int *i, int *j, int len, GSList **colors, GSList **tags, GQueue *ftattr) { - int m, n, vstart; gboolean quote = FALSE, done = FALSE;