changeset 26777:93bf089e6233

Prevent a buggy XMPP-raw plugin from causing a NUL ptr deref - instead the debug output may be slightly mangled. This came out of the veracode analysis.
author Daniel Atallah <daniel.atallah@gmail.com>
date Sat, 02 May 2009 18:42:53 +0000
parents 19d27ee1c72a
children d387f1164b3a
files libpurple/protocols/jabber/jabber.c
diffstat 1 files changed, 5 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/libpurple/protocols/jabber/jabber.c	Sat May 02 18:19:55 2009 +0000
+++ b/libpurple/protocols/jabber/jabber.c	Sat May 02 18:42:53 2009 +0000
@@ -383,6 +383,11 @@
 			char *data_start, *tag_end = strchr(tag_start, '>');
 			text = g_strdup(data);
 
+			/* Better to print out some wacky debugging than crash
+			 * due to a plugin sending bad xml */
+			if (tag_end == NULL)
+				tag_end = tag_start;
+
 			data_start = text + (tag_end - data) + 1;
 
 			last_part = strchr(data_start, '<');