pidgin: 91689600: Take care of a special case where we wou...

markdoliner at pidgin.im markdoliner at pidgin.im
Tue Aug 4 21:15:46 EDT 2009


-----------------------------------------------------------------
Revision: 91689600f61152ac853f84690c6ba65d244f7899
Ancestor: 84f1f44eb0fa1a5ffedd07fc23a7b21453088ac3
Author: markdoliner at pidgin.im
Date: 2009-08-05T01:13:12
Branch: im.pidgin.pidgin
URL: http://d.pidgin.im/viewmtn/revision/info/91689600f61152ac853f84690c6ba65d244f7899

Modified files:
        libpurple/protocols/yahoo/util.c

ChangeLog: 

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.

-------------- next part --------------
============================================================
--- libpurple/protocols/yahoo/util.c	996d28b02e4881a0b4e609100d512f45e9bdfbac
+++ libpurple/protocols/yahoo/util.c	a8bc1bc2d49d17ad52935f7db790fa42553d891e
@@ -580,11 +580,19 @@ char *yahoo_codes_to_html(const char *x)
 				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 *
 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;
 


More information about the Commits mailing list