1 <!DOCTYPE HTML PUBLIC
"-//W3C//DTD HTML 3.2//EN">
4 <TITLE> [IRCServices] Allocation error: ns unsuspend
6 <LINK REL=
"Index" HREF=
"index.html" >
7 <LINK REL=
"made" HREF=
"mailto:ircservices%40ircservices.za.net?Subject=%5BIRCServices%5D%20Allocation%20error%3A%20ns%20unsuspend&In-Reply-To=20040708194930.CMKR8778.mta02-svc.ntlworld.com%40excelsior">
8 <META NAME=
"robots" CONTENT=
"index,nofollow">
9 <META http-equiv=
"Content-Type" content=
"text/html; charset=us-ascii">
10 <LINK REL=
"Previous" HREF=
"004487.html">
11 <LINK REL=
"Next" HREF=
"004485.html">
13 <BODY BGCOLOR=
"#ffffff">
14 <H1>[IRCServices] Allocation error: ns unsuspend
</H1>
16 <A HREF=
"mailto:ircservices%40ircservices.za.net?Subject=%5BIRCServices%5D%20Allocation%20error%3A%20ns%20unsuspend&In-Reply-To=20040708194930.CMKR8778.mta02-svc.ntlworld.com%40excelsior"
17 TITLE=
"[IRCServices] Allocation error: ns unsuspend">chawmp at cyberarmy.net
19 <I>Sun Jul
25 13:
20:
28 PDT
2004</I>
21 <LI>Previous message:
<A HREF=
"004487.html">[IRCServices] Seg Fault/Bus Error on SQUIT
23 <LI>Next message:
<A HREF=
"004485.html">[IRCServices] Services
5.0.35 released
25 <LI> <B>Messages sorted by:
</B>
26 <a href=
"date.html#4538">[ date ]
</a>
27 <a href=
"thread.html#4538">[ thread ]
</a>
28 <a href=
"subject.html#4538">[ subject ]
</a>
29 <a href=
"author.html#4538">[ author ]
</a>
36 I just noticed and patched another bug, quite similar to the last issue I
37 posted about (
"Seg Fault/Bus Error on SQUIT
":
38 <A HREF=
"http://www.ircservices.za.net/pipermail/ircservices/2004/003377.html">http://www.ircservices.za.net/pipermail/ircservices/
2004/
003377.html
</A> ).
40 Again, I noticed this one because free() is set up to write a pattern over
41 memory as it is released on our services host. It wouldn't occur in most
42 normal circumstances, but might do unpredictably, depending on a lot of
43 factors, so ought to be fixed.
45 The problem occurs when unsuspending a nickname that is part of a group in
46 which no nickname has been used for longer than the NSExpire setting - or
47 something along those lines.
49 In modules/nickserv/util.c, unsuspend_nick() does this:
51 ARRAY_FOREACH (i, ngi-
>nicks) {
52 NickInfo *ni = get_nickinfo(ngi-
>nicks[i]);
56 get_nickinfo() will free (NickGroupInfo *)ngi under certain conditions
57 (roughly as I described above), making the following attempts to dereference
58 ngi crash the program:
61 module_log(
"unsuspend: unable to retrieve NickInfo
63 " (nick group %u)
", ngi-
>nicks[i], ngi-
>id);
67 ngi would also be used in subsequent loops, so just changing the log message
68 wouldn't be a solution.
70 I didn't have a lot of time to investigate the best way to fix this, but
71 here is the patch I came up with. It seems to do the job, but I would be
72 grateful if anyone can advise something more suitable. (Lines beginning
"+
"
73 were added; noexpire is just set to
1 before the loop, and restored
74 afterwards, which stops the expiry check. Note that the NSSuspendGrace stuff
75 only happens a few lines after the call to get_nickinfo(), so for that small
76 time, nick groups can disappear.).
78 void unsuspend_nick(NickGroupInfo *ngi, int set_time)
80 time_t now = time(NULL);
81 + int cache_noexpire =
0;
83 if (!ngi-
>suspendinfo) {
84 module_log(
"unsuspend: called on non-suspended nick group %u [%s]
",
88 " %u) to %ld
", ngi-
>nicks[ngi-
>mainnick], ngi-
>id,
89 (long)ngi-
>authset);
91 + cache_noexpire = noexpire;
93 ARRAY_FOREACH (i, ngi-
>nicks) {
94 NickInfo *ni = get_nickinfo(ngi-
>nicks[i]);
102 + noexpire = cache_noexpire;
106 /*************************************************************************/
110 <A HREF=
"http://www.ircservices.za.net/mailman/listinfo/ircservices">chawmp at cyberarmy.net
</A>
121 <LI>Previous message:
<A HREF=
"004487.html">[IRCServices] Seg Fault/Bus Error on SQUIT
123 <LI>Next message:
<A HREF=
"004485.html">[IRCServices] Services
5.0.35 released
125 <LI> <B>Messages sorted by:
</B>
126 <a href=
"date.html#4538">[ date ]
</a>
127 <a href=
"thread.html#4538">[ thread ]
</a>
128 <a href=
"subject.html#4538">[ subject ]
</a>
129 <a href=
"author.html#4538">[ author ]
</a>