From: Sam Smith Date: Sun, 24 Apr 2022 21:23:50 +0000 (-0700) Subject: Fixed ping X-Git-Url: https://git.patchysicp.xyz/?a=commitdiff_plain;h=0bc9ef310a93f733b39d5099ce8ccf2ac9ebc586;p=patchyircd.git Fixed ping --- diff --git a/irc.c b/irc.c index b09c5b3..cb9db64 100644 --- a/irc.c +++ b/irc.c @@ -4,8 +4,16 @@ void processPacket(struct client_data *client) { char *packet = client->buf; size_t packetLen = client->bufLen; if(strncmp(packet, "PING", 4) == 0) { + char data[1024]; packet[1] = 'O'; - send_log(client->FD, packet, packetLen, 0); + // Mem unsafe time + strcpy(packet+5+strlen("irc.patchysicp.xyz "), packet+4); + strcpy(packet+5, "irc.patchysicp.xyz "); + packet[5+strlen("irc.patchysicp.xyz ")] = ':'; + strcpy(data, ":irc.patchysicp.xyz "); + strcpy(data+strlen(":irc.patchysicp.xyz "), packet); + data[strlen(":irc.patchysicp.xyz")] = ' '; + send_log(client->FD, data, strlen(data), 0); } else if(strncmp(packet, "NICK ", 5) == 0) { // User now registered setNick(client, packet+5, 32);