From: brain Date: Wed, 21 Apr 2004 11:30:51 +0000 (+0000) Subject: Fixes for bug #13 (trailing or leading spaces on a command) X-Git-Tag: v2.0.23~10905 X-Git-Url: https://git.netwichtig.de/gitweb/?a=commitdiff_plain;h=c7ded82dec970bcb817d3ac57303d14e54fdba0d;p=user%2Fhenk%2Fcode%2Finspircd.git Fixes for bug #13 (trailing or leading spaces on a command) git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@685 e03df62e-2008-0410-955e-edbf42e46eb7 --- diff --git a/src/inspircd.cpp b/src/inspircd.cpp index 001f7e2d5..0dd8233cc 100644 --- a/src/inspircd.cpp +++ b/src/inspircd.cpp @@ -2749,6 +2749,8 @@ void process_buffer(const char* cmdbuf,userrec *user) { return; } + while ((cmdbuf[0] == ' ') && (strlen(cmdbuf)>0)) cmdbuf++; // strip leading spaces + strncpy(cmd,cmdbuf,MAXBUF); if (!strcmp(cmd,"")) { @@ -2762,6 +2764,12 @@ void process_buffer(const char* cmdbuf,userrec *user) { cmd[strlen(cmd)-1] = '\0'; } + + while ((cmd[strlen(cmd)-1] == ' ') && (strlen(cmd)>0)) // strip trailing spaces + { + cmd[strlen(cmd)-1] = '\0'; + } + if (!strcmp(cmd,"")) { return;