From c7ded82dec970bcb817d3ac57303d14e54fdba0d Mon Sep 17 00:00:00 2001 From: brain Date: Wed, 21 Apr 2004 11:30:51 +0000 Subject: 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 --- src/inspircd.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) 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; -- cgit v1.2.3