pidgin: 2ccf5f2a: Yikes. buf is on the stack and shouldn'...

markdoliner at pidgin.im markdoliner at pidgin.im
Thu Jun 18 21:30:22 EDT 2009


-----------------------------------------------------------------
Revision: 2ccf5f2aa36e16bb5f762a5bb1c64cfb11210417
Ancestor: 97a66c0626bacf523c2e9139e4ac9da24bebf44f
Author: markdoliner at pidgin.im
Date: 2009-06-19T01:28:46
Branch: im.pidgin.pidgin
URL: http://d.pidgin.im/viewmtn/revision/info/2ccf5f2aa36e16bb5f762a5bb1c64cfb11210417

Modified files:
        libpurple/protocols/yahoo/yahoo.c

ChangeLog: 

Yikes.  buf is on the stack and shouldn't be freed.  This fixes
a crash.

-------------- next part --------------
============================================================
--- libpurple/protocols/yahoo/yahoo.c	bd3929502affd03075dbf896683a64bf71feb76d
+++ libpurple/protocols/yahoo/yahoo.c	e2a90bba050db2b751e34274bdf86dd31e030db5
@@ -2311,13 +2311,11 @@ static void yahoo_p2p_read_pkt_cb(gpoint
 		purple_debug_warning("yahoo","p2p: Got something other than YMSG packet\n");
 
 		start = memchr(buf + 1, 'Y', len - 1);
-		if(start) {
-			g_memmove(buf, start, len - (start - buf));
-			len -= start - buf;
-		} else {
-			g_free(buf);
+		if (start == NULL)
 			return;
-		}
+
+		g_memmove(buf, start, len - (start - buf));
+		len -= start - buf;
 	}
 
 	pos += 4;	/* YMSG */


More information about the Commits mailing list