changeset 27830:f6dab0e7a817

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.
author Mark Doliner <mark@kingant.net>
date Wed, 05 Aug 2009 01:13:12 +0000
parents 0494db6c7f27
children 7ee833540b25
files libpurple/protocols/yahoo/util.c
diffstat 1 files changed, 11 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- 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;