From 86bc398ada76c3a6ba15f3ab00fa381e9e66edfc Mon Sep 17 00:00:00 2001 From: Michael Poole Date: Fri, 6 Mar 2009 07:40:01 -0500 Subject: [PATCH] Avoid crashing when a user is killed by an on-auth callback. src/nickserv.c (set_user_handle_info): Handle no users on the account when updating the linked list of authed users. Do not run the last bit of code when an auth_func kills the user, either. --- src/nickserv.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/nickserv.c b/src/nickserv.c index c4fe618..0ba125e 100644 --- a/src/nickserv.c +++ b/src/nickserv.c @@ -917,11 +917,14 @@ set_user_handle_info(struct userNode *user, struct handle_info *hi, int stamp) /* remove from next_authed linked list */ if (user->handle_info->users == user) { user->handle_info->users = user->next_authed; - } else { + } else if (user->handle_info->users != NULL) { for (other = user->handle_info->users; other->next_authed != user; other = other->next_authed) ; other->next_authed = user->next_authed; + } else { + /* No users authed to the account - can happen if they get + * killed for authing. */ } /* if nobody left on old handle, and they're not an oper, remove !god */ if (!user->handle_info->users && !user->handle_info->opserv_level) @@ -935,8 +938,11 @@ set_user_handle_info(struct userNode *user, struct handle_info *hi, int stamp) user->handle_info = hi; if (hi && !hi->users && !hi->opserv_level) HANDLE_CLEAR_FLAG(hi, HELPING); - for (n=0; (ndead; n++) + for (n=0; ndead) + return; + } if (hi) { struct nick_info *ni; -- 2.20.1