Skip to content

Commit

Permalink
mod_irc_relay: Fix improper assertion.
Browse files Browse the repository at this point in the history
find_chanpair previously asserted that channel
was not NULL. However, it can be NULL for commands
for which there is not a channel, e.g. NICK, which
previously caused the BBS to abort. Instead, we
should just return no match and continue.
  • Loading branch information
InterLinked1 committed Oct 9, 2023
1 parent 71b0dee commit 6fdf142
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion modules/mod_irc_relay.c
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,11 @@ static struct chan_pair *find_chanpair(const char *client, const char *channel)
{
struct chan_pair *cp = NULL;

bbs_assert_exists(channel);
if (strlen_zero(channel)) {
/* Could be NULL where there's no channel from the remote network, e.g. for NICK command, etc. */
bbs_debug(9, "No channel, no match!\n");
return NULL;
}

RWLIST_RDLOCK(&mappings);
RWLIST_TRAVERSE(&mappings, cp, entry) {
Expand Down

0 comments on commit 6fdf142

Please sign in to comment.