From: Pekka Riikonen Date: Wed, 14 Feb 2001 21:15:40 +0000 (+0000) Subject: Little for loop fix in silc_server_command_whois_parse. X-Git-Tag: SILC.0.1~223 X-Git-Url: http://git.silcnet.org/gitweb/?a=commitdiff_plain;h=338d7f055cd18f123ed0479c834331867c818ebf;p=silc.git Little for loop fix in silc_server_command_whois_parse. --- diff --git a/CHANGES b/CHANGES index ad7c0427..42d24445 100644 --- a/CHANGES +++ b/CHANGES @@ -41,6 +41,12 @@ Wed Feb 14 16:03:25 EET 2001 Pekka Riikonen global ID list for the channel as it might not be in the local list. Fixed a bug related to LEAVE command. + * Is this the end of the [] buglet that has been lurking + around for a long time? A little for loop fix in server's + silc_server_command_whois_parse that is used by both IDENTIFY + and WHOIS command. At least, this was a clear bug and a cause + of one type of [] buglet. + Tue Feb 13 19:55:59 EET 2001 Pekka Riikonen * Added --with-gmp configuration option. If set the GMP diff --git a/apps/silcd/command.c b/apps/silcd/command.c index 3241d595..b1cc5c1e 100644 --- a/apps/silcd/command.c +++ b/apps/silcd/command.c @@ -359,14 +359,15 @@ silc_server_command_whois_parse(SilcServerCommandContext cmd, /* Take all ID's from the command packet */ if (argc > 3) { - for (k = 1, i = 4; i < argc; i++) { + for (k = 1, i = 4; i < argc + 1; i++) { tmp = silc_argument_get_arg_type(cmd->args, i, &len); if (tmp) { *client_id = silc_realloc(*client_id, sizeof(**client_id) * (*client_id_count + 1)); (*client_id)[k] = silc_id_payload_parse_id(tmp, len); if ((*client_id)[k] == NULL) { - for (i = 0; i < k; i++) + /* Cleanup all and fail */ + for (i = 0; i < *client_id_count; i++) silc_free((*client_id)[i]); silc_free(*client_id); return FALSE;