changeset 18616:c3c610e73fc0

I'm hoping this will fix a semi-random and semi-random infinite looping bug when parsing buddy info in oscar. Maybe only for ICQ. We've been seeing this at meebo a lot the past three weeks or so. References #2078.
author Mark Doliner <mark@kingant.net>
date Sun, 22 Jul 2007 22:08:13 +0000
parents 0ad0bdb0063b
children f79b6bb6bb5f 9eb399e7cacd
files libpurple/protocols/oscar/family_locate.c
diffstat 1 files changed, 5 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/libpurple/protocols/oscar/family_locate.c	Sun Jul 22 18:17:26 2007 +0000
+++ b/libpurple/protocols/oscar/family_locate.c	Sun Jul 22 22:08:13 2007 +0000
@@ -816,7 +816,11 @@
 			 */
 			int type2, number, length2;
 
-			while (byte_stream_curpos(bs) < endpos) {
+			/*
+			 * Continue looping as long as we're able to read type2,
+			 * number, and length2.
+			 */
+			while (byte_stream_curpos(bs) + 4 <= endpos) {
 				type2 = byte_stream_get16(bs);
 				number = byte_stream_get8(bs);
 				length2 = byte_stream_get8(bs);