Remove leading spaces from the CLI command before parsing

If you've mistakenly put a space before typing in a command, the
leading space will be included as part of the command, and the command
parser will not find the corresponding command. This patch rectifies
that situation by stripping the leading spaces on commands.

Review: https://reviewboard.asterisk.org/r/2709/
Patch-by: Tilghman Lesher
........

Merged revisions 396745 from http://svn.asterisk.org/svn/asterisk/branches/1.8
........

Merged revisions 396746 from http://svn.asterisk.org/svn/asterisk/branches/11


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@396747 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
Kinsey Moore
2013-08-15 16:37:06 +00:00
parent 6d24165dee
commit bd352e0827
2 changed files with 12 additions and 0 deletions

View File

@@ -2292,6 +2292,13 @@ static char *parse_args(const char *s, int *argc, const char *argv[], int max, i
return NULL;
cur = duplicate;
/* Remove leading spaces from the command */
while (isspace(*s)) {
cur++;
s++;
}
/* scan the original string copying into cur when needed */
for (; *s ; s++) {
if (x >= max - 1) {