From 1e059b6456f432816a69a0a8595fef120b5eab1c Mon Sep 17 00:00:00 2001 From: Egor Date: Thu, 19 Oct 2023 17:27:36 +0300 Subject: [PATCH] fix crash with NULL peername --- src/irc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/irc.c b/src/irc.c index 274c726..b623b81 100644 --- a/src/irc.c +++ b/src/irc.c @@ -292,7 +292,7 @@ int processPacket(struct client_data *client, char *source, char *command, int a client->realname = mystrdup(args[3]); if (!client->realname) abort(); - client->hostname = mystrdup(!strcmp(client->peername, "127.0.0.1") ? "localhost" : hostname); + client->hostname = mystrdup(client->peername && !strcmp(client->peername, "127.0.0.1") ? "localhost" : hostname); if (!client->hostname) abort(); // Send welcome -- 2.56.0