[IRCServices Coding] Re: [IRCServices] IRC Services 5.0a24 segfault on startup

Andrew Church achurch at achurch.org
Wed Mar 13 14:39:49 PST 2002


>>>      If you can track this down it would be appreciated.  
>>
>>The crash was much easier to find that I thought. The function 
>>add_nickgroupinfo raises the SEGFAULT "on purpose"
>
>     Yes, I know that because I added it. :P  I was hoping for a backtrace
>or some other hint of why the nickgroup was being added in the first place.
>
>  --Andrew Church
>    achurch at achurch.org
>    http://achurch.org/

     Okay, I think I've found it--try the following patch:

--- modules/database/version4.c	1 Mar 2002 01:49:24 -0000	2.81
+++ modules/database/version4.c	13 Mar 2002 05:25:18 -0000	2.82
@@ -277,7 +277,15 @@
 	    ngi->language = LANG_DEFAULT;
 	ngi->timezone = TIMEZONE_DEFAULT;
 	ni->nickgroup = ngi->id;
-	add_nickgroupinfo(ngi);
+	if (ngi->id != 0) {
+	    add_nickgroupinfo(ngi);
+	} else {
+	    free_nickgroupinfo(ngi);
+	    if (!(ni->status & NS_VERBOTEN)) {
+		module_log("warning: nick %s has no nick group but is not"
+			   " forbidden (corrupt database or BUG?)", ni->nick);
+	    }
+	}
     }
     return ni;
 

  --Andrew Church
    achurch at achurch.org
    http://achurch.org/