Re: EB-Lite version

"A. Craig West" <[email protected]>
Newsgroups gmane.network.everybuddy.user
Message-ID <[email protected]>
On Sun, 2 Mar 2003, Meredydd Luff wrote:

> Run the core under GDB, and get a backtrace. Start by "gdb path/to/eb-lite", 
> and when the segfault happens, type "bt full" and send the splurge that 
> follows to the list.
> 
> Meredydd

In the true spirit of open source, I have attached a patch. It turns out that
ext_yahoo_got_buddies in yahoo.c is called with an id that does not actually
correspond to an actual account. In the interest of not causing conflicting
coding styles, I copied the test for this from some of the other yahoo.c
methods that tested for it.

-- 
Craig West         Ph: (416) 567-1491	|  It's not a bug,
[email protected]              	|  It's a feature...
eb-lite.patch (text/plain, 1.6 KB)
--- eb-lite/plugins/yahoo/yahoo.c	2003-03-01 12:33:12.000000000 -0500
+++ eb-lite-patched/plugins/yahoo/yahoo.c	2003-03-08 01:07:41.000000000 -0500
@@ -405,9 +405,13 @@
 static void ext_yahoo_status_changed(int id, char *who, int stat, char *msg, int away)
 {
 	eb_local_account *ela = eb_yahoo_find_local_account_by_id(id);
-	eb_account * acc = eb_get_account(ela->handle, "Yahoo", who);
+	eb_account * acc;
 	int was_offline;
 
+	if(ela==NULL) { return; }
+
+	acc = eb_get_account(ela->handle, "Yahoo", who);
+
 	if(acc==NULL)
 	{ LOG(("No account match for status notify %s!", who)); }
 
@@ -437,6 +441,8 @@
 	eb_local_account *ela = eb_yahoo_find_local_account_by_id(id);
 	YList * l;
 
+	if(ela==NULL) { return; }
+
 	for(l = buds; l; l=l->next) {
 		struct yahoo_buddy *bud = l->data;
 
@@ -476,9 +482,13 @@
 
 	if(msg) {
 		eb_local_account *ela = eb_yahoo_find_local_account_by_id(id);
-		eb_account *sender = eb_yahoo_get_remote_account(ela, who);
+		eb_account *sender;
 		char buff[2048];
 
+		if(ela==NULL) { return; }
+		
+		sender = eb_yahoo_get_remote_account(ela, who);
+
 		if(tm) {
 			char newmessage[4096];
 			char timestr[2048];
@@ -589,10 +599,14 @@
 static void ext_yahoo_login_response(int id, int succ, char *url)
 {
 	eb_local_account *ela = eb_yahoo_find_local_account_by_id(id);
-	yahoo_local_account *yla = ela->protocol_account_data;
+	yahoo_local_account *yla;
 
 	char buff[1024];
 
+	if(ela==NULL) { return; }
+
+	yla = ela->protocol_account_data;
+
 	if(succ == YAHOO_LOGIN_OK) {
 		yla->status = yahoo_current_status(id);
 		ela->ready = 1;
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.