From ca02216ca9405c541a56355f696da7a7c998e119 Mon Sep 17 00:00:00 2001 From: Egor Date: Mon, 2 May 2022 22:58:09 +0300 Subject: [PATCH] add error messages for parsing failures --- irc.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/irc.c b/irc.c index e045c96..b364243 100644 --- 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 } -- 2.56.0