changeset 31625:53096ba34fe6

jabber: Properly parse realm="" in DIGEST-MD5, which is apparently valid. On a marginally related note, the ABNF in this RFC is really ugly. Refs #a14514.
author Paul Aurich <paul@darkrain42.org>
date Wed, 02 Feb 2011 05:51:09 +0000
parents e743507b3767
children 6448e3f3ddd4
files ChangeLog libpurple/protocols/jabber/auth_digest_md5.c
diffstat 2 files changed, 4 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Wed Feb 02 05:47:50 2011 +0000
+++ b/ChangeLog	Wed Feb 02 05:51:09 2011 +0000
@@ -58,6 +58,8 @@
 	  (Nikita Kozlov) (#13136)
 	* Handle Connection: Close headers for BOSH, when the server does not
 	  terminate the connection itself. (#13008)
+	* Improved parsing for DIGEST-MD5, which should resolve issues
+	  connecting to some jabberd2 servers. (#a14514)
 
 	Yahoo!/Yahoo! JAPAN:
 	* Fix a crash when an account disconnects before a p2p session is
--- a/libpurple/protocols/jabber/auth_digest_md5.c	Wed Feb 02 05:47:50 2011 +0000
+++ b/libpurple/protocols/jabber/auth_digest_md5.c	Wed Feb 02 05:51:09 2011 +0000
@@ -78,12 +78,12 @@
 					val_start++;
 
 				val_end = cur;
-				while (val_end != val_start && (*val_end == ' ' || *val_end == ',' || *val_end == '\t'
+				while (val_end >= val_start && (*val_end == ' ' || *val_end == ',' || *val_end == '\t'
 						|| *val_end == '\r' || *val_end == '\n'
 						|| *val_end == '"'  || *val_end == '\0'))
 					val_end--;
 
-				if (val_start != val_end)
+				if (val_end - val_start + 1 >= 0)
 					value = g_strndup(val_start, val_end - val_start + 1);
 			}