From 4676f67b6f63bd7d113c126ec151396fa602f037 Mon Sep 17 00:00:00 2001 From: Markus Uhlin Date: Mon, 25 Nov 2024 00:12:01 +0100 Subject: process_input: added null check --- FICS/command.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'FICS/command.c') diff --git a/FICS/command.c b/FICS/command.c index d1f627e..b3f4e29 100644 --- a/FICS/command.c +++ b/FICS/command.c @@ -1089,6 +1089,9 @@ process_input(int fd, char *com_string) if (p < 0) { fprintf(stderr, "FICS: Input from a player not in array!\n"); return -1; + } else if (com_string == NULL) { + fprintf(stderr, "FICS: Command string is NULL!\n"); + return -1; } commanding_player = p; @@ -1107,7 +1110,7 @@ process_input(int fd, char *com_string) case PLAYER_LOGIN: retval = process_login(p, com_string); - if (retval == COM_LOGOUT && com_string != NULL) { + if (retval == COM_LOGOUT) { // && com_string != NULL fprintf(stderr, "%s tried to log in and failed.\n", com_string); } -- cgit v1.2.3