diff --git a/main/asterisk.c b/main/asterisk.c index a734897b97..4493445aec 100644 --- a/main/asterisk.c +++ b/main/asterisk.c @@ -1977,6 +1977,11 @@ static int remoteconsolehandler(char *s) /* Called when readline data is available */ if (!ast_all_zeros(s)) ast_el_add_history(s); + + while (isspace(*s)) { + s++; + } + /* The real handler for bang */ if (s[0] == '!') { if (s[1]) diff --git a/main/cli.c b/main/cli.c index d64fd14360..5e6263d386 100644 --- a/main/cli.c +++ b/main/cli.c @@ -2299,6 +2299,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) {