]> git.netwichtig.de Git - user/henk/code/inspircd.git/commitdiff
Fixes for bug #13 (trailing or leading spaces on a command)
authorbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>
Wed, 21 Apr 2004 11:30:51 +0000 (11:30 +0000)
committerbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>
Wed, 21 Apr 2004 11:30:51 +0000 (11:30 +0000)
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@685 e03df62e-2008-0410-955e-edbf42e46eb7

src/inspircd.cpp

index 001f7e2d57a04d45f6dc2f946aaaf402780d16df..0dd8233cc4de85f454147676b8512dd63f3443a4 100644 (file)
@@ -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;