changeset 15221:3043806ad900

[gaim-migrate @ 18011] I think this'll fix an occasional "invalid read of size 1 bytes" message from valgrind. I'm not sure when it happens... it seems like it would only happen for invalid packets (ones that don't end in 0xc0 80 or whatever it is) committer: Tailor Script <tailor@pidgin.im>
author Mark Doliner <mark@kingant.net>
date Sun, 17 Dec 2006 04:55:12 +0000
parents 152756b02fca
children 26357b7f117e
files libgaim/protocols/yahoo/yahoo_packet.c
diffstat 1 files changed, 3 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/libgaim/protocols/yahoo/yahoo_packet.c	Sat Dec 16 09:58:26 2006 +0000
+++ b/libgaim/protocols/yahoo/yahoo_packet.c	Sun Dec 17 04:55:12 2006 +0000
@@ -155,8 +155,8 @@
 		pair->key = strtol(key, NULL, 10);
 		accept = x; /* if x is 0 there was no key, so don't accept it */
 
-		if (pos > len) {
-			/* Truncated. Garbage or something. */
+		if (pos + 1 > len) {
+			/* Malformed packet! (Truncated--garbage or something) */
 			accept = FALSE;
 		}
 
@@ -164,7 +164,7 @@
 			delimiter = (const guchar *)strstr((char *)&data[pos], "\xc0\x80");
 			if (delimiter == NULL)
 			{
-				/* Malformed packet! (it doesn't end in 0xc0 0x80) */
+				/* Malformed packet! (It doesn't end in 0xc0 0x80) */
 				g_free(pair);
 				pos = len;
 				continue;