From 6376e7788be860409fa6bff5441a682298a82873 Mon Sep 17 00:00:00 2001 From: pk910 Date: Sat, 13 Aug 2011 02:45:46 +0200 Subject: [PATCH] we shouldn't parse args if there are no args --- modcmd.c | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/modcmd.c b/modcmd.c index 1f6a541..6db797b 100644 --- a/modcmd.c +++ b/modcmd.c @@ -85,15 +85,17 @@ static void handle_command(struct ClientSocket *client, struct UserNode *user, s char *arga[MAXNUMPARAMS]; char **argv; int argc = 0; - while(*args) { - //skip leading spaces - while (*args == ' ') - *args++ = 0; - arga[argc++] = args; - if (argc >= MAXNUMPARAMS) - break; - while (*args != ' ' && *args) - args++; + if(args) { + while(*args) { + //skip leading spaces + while (*args == ' ') + *args++ = 0; + arga[argc++] = args; + if (argc >= MAXNUMPARAMS) + break; + while (*args != ' ' && *args) + args++; + } } argv = arga; if(argc != 0 && argv[0][0] == '#') { -- 2.20.1