pidgin: 960cd18d: Fix a race condition that can result in ...

datallah at pidgin.im datallah at pidgin.im
Thu Jan 1 17:46:09 EST 2009


-----------------------------------------------------------------
Revision: 960cd18dc3e93e7cd7fa1c03ac22804ae128a9c3
Ancestor: ab6205fa52f8758e804fb6fdae3429c0c3ab8fb3
Author: datallah at pidgin.im
Date: 2009-01-01T22:43:01
Branch: im.pidgin.pidgin
URL: http://d.pidgin.im/viewmtn/revision/info/960cd18dc3e93e7cd7fa1c03ac22804ae128a9c3

Modified files:
        libpurple/protocols/bonjour/mdns_win32.c

ChangeLog: 

Fix a race condition that can result in a NULL ptr deref. Fixes #7920.

-------------- next part --------------
============================================================
--- libpurple/protocols/bonjour/mdns_win32.c	dd810abbd21d8527a901ce999b4dcb9a6ad0fee7
+++ libpurple/protocols/bonjour/mdns_win32.c	6ee6360a9961b40e98aee96a236f8e7e0ee1fa2f
@@ -167,8 +167,12 @@ _mdns_resolve_host_callback(GSList *host
 	ResolveCallbackArgs *args = (ResolveCallbackArgs*) data;
 	Win32BuddyImplData *idata = args->bb->mdns_impl_data;
 	gboolean delete_buddy = FALSE;
-	PurpleBuddy *pb;
+	PurpleBuddy *pb = NULL;
 
+	/* Make sure that the BonjourBuddy associated with this request is still around */
+	if (g_slist_find(pending_buddies, args->bb) == NULL)
+		goto cleanup;
+
 	if ((pb = purple_find_buddy(args->account, args->bb->name)))
 		if (pb->proto_data != args->bb)
 			purple_debug_error("bonjour", "Found purple buddy for %s not matching bonjour buddy record. "
@@ -209,6 +213,8 @@ _mdns_resolve_host_callback(GSList *host
 
 	}
 
+	cleanup:
+
 	/* free the hosts list*/
 	while (hosts != NULL) {
 		hosts = g_slist_remove(hosts, hosts->data);


More information about the Commits mailing list