1
0
mirror of https://github.com/osmarks/ngircd.git synced 2024-10-27 20:36:18 +00:00

Fix a possible race condition in Client_Introduce()

Conf_GetServer() can return NULL when the server introducing the client
had a write error for example, and is being disconnected.

So make sure that we have a valid server before calling Conf_NickIsService()!
This commit is contained in:
Alexander Barton 2021-12-30 20:31:41 +01:00
parent 3675c7567c
commit 1db3447c90

View File

@ -1315,12 +1315,14 @@ Client_Reject(CLIENT *Client, const char *Reason, bool InformClient)
GLOBAL void
Client_Introduce(CLIENT *From, CLIENT *Client, int Type)
{
int server;
/* Set client type (user or service) */
Client_SetType(Client, Type);
if (From) {
if (Conf_NickIsService(Conf_GetServer(Client_Conn(From)),
Client_ID(Client)))
server = Conf_GetServer(Client_Conn(From));
if (server > NONE && Conf_NickIsService(server, Client_ID(Client)))
Client_SetType(Client, CLIENT_SERVICE);
LogDebug("%s \"%s\" (+%s) registered (via %s, on %s, %d hop%s).",
Client_TypeText(Client), Client_Mask(Client),