diff libpurple/protocols/gg/lib/message.c @ 31936:3b8415185090

Accept broken URLs from third-party GG clients same as official GG. This patch is r1096 upstream, thanks to tomkiewicz again. Fixes #13886.
author Ethan Blanton <elb@pidgin.im>
date Sun, 01 May 2011 16:36:39 +0000
parents 93b08d43f684
children
line wrap: on
line diff
--- a/libpurple/protocols/gg/lib/message.c	Sat Apr 30 16:27:01 2011 +0000
+++ b/libpurple/protocols/gg/lib/message.c	Sun May 01 16:36:39 2011 +0000
@@ -361,7 +361,7 @@
  * \param src Dodawany tekst
  * \param len Długość dodawanego tekstu
  */
-static void gg_append(char *dst, int *pos, const void *src, int len)
+static void gg_append(char *dst, size_t *pos, const void *src, int len)
 {
 	if (dst != NULL)
 		memcpy(&dst[*pos], src, len);
@@ -394,7 +394,8 @@
 	int format_idx = 0;
 	unsigned char old_attr = 0;
 	const unsigned char *color = (const unsigned char*) "\x00\x00\x00";
-	int len, i;
+	int i;
+	size_t len;
 	const unsigned char *format_ = (const unsigned char*) format;
 
 	len = 0;
@@ -584,6 +585,11 @@
 	entity = NULL;
 
 	for (src = html; *src != 0; src++) {
+		if (in_entity && !(isalnum(*src) || *src == '#' || *src == ';')) {
+			in_entity = 0;
+			gg_append(dst, &len, entity, src - entity);
+		}
+
 		if (*src == '<') {
 			tag = src;
 			in_tag = 1;