summaryrefslogtreecommitdiff
path: root/src/inspircd.cpp
diff options
context:
space:
mode:
authorbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2004-04-21 11:30:51 +0000
committerbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2004-04-21 11:30:51 +0000
commitc7ded82dec970bcb817d3ac57303d14e54fdba0d (patch)
tree9361febca4579cd751ab051c03fbdd557faf77ec /src/inspircd.cpp
parent3e60d1e0abcb462597dbedf1f3e0cfcf3bdec9a7 (diff)
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
Diffstat (limited to 'src/inspircd.cpp')
-rw-r--r--src/inspircd.cpp8
1 files changed, 8 insertions, 0 deletions
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;