From 7b6d1973e34327e5b93543222245e81a0f73bc99 Mon Sep 17 00:00:00 2001 From: Markus Uhlin Date: Sat, 5 Apr 2025 20:02:09 +0200 Subject: Fixed program logic mistakes, found by PVS-Studio --- FICS/command.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'FICS/command.c') diff --git a/FICS/command.c b/FICS/command.c index 528bdf9..569c27a 100644 --- a/FICS/command.c +++ b/FICS/command.c @@ -132,7 +132,11 @@ parse_command(char *com_string, char **comm, char **parameters) PUBLIC int alias_lookup(char *tmp, alias_type *alias_list, int numalias) { - for (int i = 0; (alias_list[i].comm_name && i < numalias); i++) { + if (numalias >= MAX_ALIASES) + return -1; + for (int i = 0; + (i < numalias && alias_list[i].comm_name != NULL); + i++) { if (!strcmp(tmp, alias_list[i].comm_name)) return i; } -- cgit v1.2.3