ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/svn/ircd-hybrid/trunk/src/parse.c
(Generate patch)

Comparing ircd-hybrid/trunk/src/parse.c (file contents):
Revision 9373 by michael, Sat Feb 1 13:36:10 2020 UTC vs.
Revision 9374 by michael, Sat May 9 20:54:46 2020 UTC

# Line 220 | Line 220 | static void
220   parse_handle_command(struct Message *message, struct Client *source,
221                       unsigned int i, char *para[])
222   {
223 +  const struct MessageHandler *const handler = &message->handlers[source->from->handler];
224 +
225    if (IsServer(source->from))
226      ++message->rcount;
227    ++message->count;
# Line 228 | Line 230 | parse_handle_command(struct Message *mes
230      flood_endgrace(source);
231  
232    /* Check right amount of parameters is passed... --is */
233 <  if (i < message->args_min)
233 >  if (handler->args_min &&
234 >      ((i < handler->args_min) ||
235 >       (handler->empty_last_arg != true && EmptyString(para[handler->args_min - 1]))))
236      sendto_one_numeric(source, &me, ERR_NEEDMOREPARAMS, message->cmd);
237    else
238 <    message->handlers[source->from->handler](source, i, para);
238 >    handler->handler(source, i, para);
239   }
240  
241   /*
# Line 366 | Line 370 | parse(struct Client *client, char *pbuff
370  
371      assert(message->cmd);
372  
373 <    paramcount = message->args_max;
373 >    paramcount = message->handlers[from->from->handler].args_max;
374  
375      size_t length = bufend - ((s) ? s : ch);
376      message->bytes += length;
377    }
378  
379 +  memset(para, 0, sizeof(para));
380 +
381    /*
382     * Must the following loop really be so devious? On surface it
383     * splits the message to parameters from blank spaces. But, if
# Line 393 | Line 399 | parse(struct Client *client, char *pbuff
399  
400    if (s)
401    {
402 <    if (paramcount > MAXPARA)
402 >    if (paramcount == 0 || paramcount > MAXPARA)
403        paramcount = MAXPARA;
404  
405      while (true)

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines