Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
net_irc: Fix NULL dereference regression for nodeless users.
Built-in services (e.g. ChanServ, MessageServ) do not have a node, but can still trigger code that may attempt to dereference a user's node. Check if node is non-NULL in all of these cases. In theory, this is done automatically by APIs like bbs_auto_any_fd_writef, which automatically check if the provided node or file descriptor are NULL or -1 before using them. However, commit 8f15550 changed net_irc (and other modules) from storing file descriptors directly on the module's private structure to storing it on the node. Prior to this change, we would have directly passed NULL and -1 to these sorts of functions. However, as ChanServ and MessageServ do not have a node, these now can trigger NULL dereferences since we would attempt to access node->wfd, even if node is NULL. To address this, explicitly check if the node is NULL, and just pass -1 explicitly if so.
- Loading branch information