gaim/gaim

269b8d2a9ec0
Parents 1f2178db5c0a
Children d5392ae64a8b
so...that was weird. I got sent a packet capture of Yahoo! sending this guy
a YHOO packet...in the middle of the YMSG stream. This should handle
that kind of weirdness a little better.
--- a/ChangeLog Fri Feb 18 17:40:27 2005 -0500
+++ b/ChangeLog Fri Feb 18 21:33:12 2005 -0500
@@ -1,5 +1,9 @@
Gaim: The Pimpin' Penguin IM Client that's good for the soul!
+version 1.1.4
+ * Fixed a bug where Yahoo! would lose messages (and any other packet
+ really)
+
version 1.1.3 (2/17/2005):
* CHAP authentication support for SOCKS5 proxies (Malcolm Smith)
* ICQ offline messages are sent using your specified character
--- a/src/protocols/yahoo/yahoo.c Fri Feb 18 17:40:27 2005 -0500
+++ b/src/protocols/yahoo/yahoo.c Fri Feb 18 21:33:12 2005 -0500
@@ -2166,6 +2166,28 @@
if (yd->rxlen < YAHOO_PACKET_HDRLEN)
return;
+ if (strncmp(yd->rxqueue, "YMSG", MIN(4, yd->rxlen)) != 0) {
+ /* HEY! This isn't even a YMSG packet. What
+ * are you trying to pull? */
+ guchar *start;
+
+ gaim_debug_warning("yahoo", "Error in YMSG stream, got something not a YMSG packet!");
+
+ start = memchr(yd->rxqueue, 'Y', yd->rxlen);
+ if (start) {
+ g_memmove(yd->rxqueue, start, yd->rxlen - (start - yd->rxqueue));
+ yd->rxlen -= start - yd->rxqueue;
+ continue;
+ } else {
+ /* hmm this could screw up with just the Y, YM, or YMS is at the very
+ end of the packet */
+ g_free(yd->rxqueue);
+ yd->rxqueue = NULL;
+ yd->rxlen = 0;
+ return;
+ }
+ }
+
pos += 4; /* YMSG */
pos += 2;
pos += 2;