# HG changeset patch # User Tim Ringenbach # Date 1108780687 0 # Node ID 74cc119beceb35566f8e68f0e747ad5e5b4a366f # Parent 6239870efd8ececfcbf10183d16c9b0e0039af5c [gaim-migrate @ 12063] Better handling of nonYMSG packets in HEAD. I think needing this is madness. committer: Tailor Script diff -r 6239870efd8e -r 74cc119beceb src/protocols/yahoo/yahoo.c --- a/src/protocols/yahoo/yahoo.c Fri Feb 18 04:22:53 2005 +0000 +++ b/src/protocols/yahoo/yahoo.c Sat Feb 19 02:38:07 2005 +0000 @@ -1954,6 +1954,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;