]> PatchyGit - patchyircd.git/commitdiff
add error messages for parsing failures
authorEgor <egor@patchysicp.xyz>
Mon, 2 May 2022 19:58:09 +0000 (22:58 +0300)
committerEgor <egor@patchysicp.xyz>
Mon, 2 May 2022 19:58:09 +0000 (22:58 +0300)
irc.c

diff --git a/irc.c b/irc.c
index e045c96..b364243 100644 (file)
--- a/irc.c
+++ b/irc.c
@@ -13,12 +13,16 @@ int processPacket(struct client_data *client) {
                { // remove \r
                        char *end = strchr(p, '\n');
                        if (!end) {
+                               printf("Client %"PRISocket" sent a NULL\n", client->FD);
+                               fflush(stdout);
                                killConnection(client, false);
                                return 1; // null detected
                        }
                        if (end > p && end[-1] == '\r')
                                end[-1] = '\n';
                        if (strchr(p, '\r')) {
+                               printf("Client %"PRISocket" sent an extra CR\n", client->FD);
+                               fflush(stdout);
                                killConnection(client, false);
                                return 1; // internal \r detected
                        }