]> PatchyGit - patchyircd.git/commitdiff
fix crash with NULL peername
authorEgor <egor@patchysicp.xyz>
Thu, 19 Oct 2023 14:27:36 +0000 (17:27 +0300)
committerEgor <egor@patchysicp.xyz>
Thu, 19 Oct 2023 14:27:36 +0000 (17:27 +0300)
src/irc.c

index 274c726..b623b81 100644 (file)
--- 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