changeset 24861:c73a891d26a6

Fix a race condition that can result in a NULL ptr deref. Fixes #7920.
author Daniel Atallah <daniel.atallah@gmail.com>
date Thu, 01 Jan 2009 22:43:01 +0000
parents d6c2d6c9fd2a
children 8b55fcc6adde
files libpurple/protocols/bonjour/mdns_win32.c
diffstat 1 files changed, 7 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/libpurple/protocols/bonjour/mdns_win32.c	Thu Jan 01 19:29:30 2009 +0000
+++ b/libpurple/protocols/bonjour/mdns_win32.c	Thu Jan 01 22:43:01 2009 +0000
@@ -167,7 +167,11 @@
 	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)
@@ -209,6 +213,8 @@
 
 	}
 
+	cleanup:
+
 	/* free the hosts list*/
 	while (hosts != NULL) {
 		hosts = g_slist_remove(hosts, hosts->data);