+++ /dev/null
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
-<HTML>
- <HEAD>
- <TITLE> [IRCServices] Allocation error: ns unsuspend
- </TITLE>
- <LINK REL="Index" HREF="index.html" >
- <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">
- <META NAME="robots" CONTENT="index,nofollow">
- <META http-equiv="Content-Type" content="text/html; charset=us-ascii">
- <LINK REL="Previous" HREF="004487.html">
- <LINK REL="Next" HREF="004485.html">
- </HEAD>
- <BODY BGCOLOR="#ffffff">
- <H1>[IRCServices] Allocation error: ns unsuspend</H1>
- <B>Chawmp</B>
- <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"
- TITLE="[IRCServices] Allocation error: ns unsuspend">chawmp at cyberarmy.net
- </A><BR>
- <I>Sun Jul 25 13:20:28 PDT 2004</I>
- <P><UL>
- <LI>Previous message: <A HREF="004487.html">[IRCServices] Seg Fault/Bus Error on SQUIT
-</A></li>
- <LI>Next message: <A HREF="004485.html">[IRCServices] Services 5.0.35 released
-</A></li>
- <LI> <B>Messages sorted by:</B>
- <a href="date.html#4538">[ date ]</a>
- <a href="thread.html#4538">[ thread ]</a>
- <a href="subject.html#4538">[ subject ]</a>
- <a href="author.html#4538">[ author ]</a>
- </LI>
- </UL>
- <HR>
-<!--beginarticle-->
-<PRE>Hi again,
-
-I just noticed and patched another bug, quite similar to the last issue I
-posted about ("Seg Fault/Bus Error on SQUIT":
-<A HREF="http://www.ircservices.za.net/pipermail/ircservices/2004/003377.html">http://www.ircservices.za.net/pipermail/ircservices/2004/003377.html</A> ).
-
-Again, I noticed this one because free() is set up to write a pattern over
-memory as it is released on our services host. It wouldn't occur in most
-normal circumstances, but might do unpredictably, depending on a lot of
-factors, so ought to be fixed.
-
-The problem occurs when unsuspending a nickname that is part of a group in
-which no nickname has been used for longer than the NSExpire setting - or
-something along those lines.
-
-In modules/nickserv/util.c, unsuspend_nick() does this:
-
- ARRAY_FOREACH (i, ngi->nicks) {
- NickInfo *ni = get_nickinfo(ngi->nicks[i]);
- ...
- }
-
-get_nickinfo() will free (NickGroupInfo *)ngi under certain conditions
-(roughly as I described above), making the following attempts to dereference
-ngi crash the program:
-
- if (!ni) {
- module_log("unsuspend: unable to retrieve NickInfo
-for %s"
- " (nick group %u)", ngi->nicks[i], ngi->id);
- continue;
- }
-
-ngi would also be used in subsequent loops, so just changing the log message
-wouldn't be a solution.
-
-I didn't have a lot of time to investigate the best way to fix this, but
-here is the patch I came up with. It seems to do the job, but I would be
-grateful if anyone can advise something more suitable. (Lines beginning "+"
-were added; noexpire is just set to 1 before the loop, and restored
-afterwards, which stops the expiry check. Note that the NSSuspendGrace stuff
-only happens a few lines after the call to get_nickinfo(), so for that small
-time, nick groups can disappear.).
-
- void unsuspend_nick(NickGroupInfo *ngi, int set_time)
- {
- time_t now = time(NULL);
-+ int cache_noexpire = 0;
-
- if (!ngi->suspendinfo) {
- module_log("unsuspend: called on non-suspended nick group %u [%s]",
-
-...
-
- " %u) to %ld", ngi->nicks[ngi->mainnick], ngi->id,
- (long)ngi->authset);
- }
-+ cache_noexpire = noexpire;
-+ noexpire = 1;
- ARRAY_FOREACH (i, ngi->nicks) {
- NickInfo *ni = get_nickinfo(ngi->nicks[i]);
- if (!ni) {
-
-...
-
- }
- }
- }
-+ noexpire = cache_noexpire;
- }
-
-
-/*************************************************************************/
-
---
-Tom McIntyre
-<A HREF="http://www.ircservices.za.net/mailman/listinfo/ircservices">chawmp at cyberarmy.net</A>
-
-
-
-
-</PRE>
-
-<!--endarticle-->
- <HR>
- <P><UL>
- <!--threads-->
- <LI>Previous message: <A HREF="004487.html">[IRCServices] Seg Fault/Bus Error on SQUIT
-</A></li>
- <LI>Next message: <A HREF="004485.html">[IRCServices] Services 5.0.35 released
-</A></li>
- <LI> <B>Messages sorted by:</B>
- <a href="date.html#4538">[ date ]</a>
- <a href="thread.html#4538">[ thread ]</a>
- <a href="subject.html#4538">[ subject ]</a>
- <a href="author.html#4538">[ author ]</a>
- </LI>
- </UL>
-
-</body></html>